Check whether an error was returned by the HTTP POST to the `agents/` endpoint before invoking `/var/ossec/bin/manage_agents` in order to register a new agent. It seems like that if an agent has already been registered under the given name, the HTTP POST will return an error that'll cause the next task, which is meant to retrieve the agent information, to be skipped. That'll cause the agent registration task to fail in return. Instead, this change will cause the aforementioned task to be skipped, too. So, if an agent has already been successfully registered and the playbook is re-run, it'll run all the way to the end. If anything goes wrong (during the registration process) and the agent fails to start, the `restart wazuh-agent` handler will still fail. |
||
|---|---|---|
| playbooks | ||
| roles | ||
| .gitignore | ||
| .yamllint | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
| VERSION | ||
Wazuh-Ansible
These playbooks install and configure Wazuh agent, manager and Elastic Stack.
Documentation
Directory structure
├── wazuh-ansible
│ ├── roles
│ │ ├── elastic-stack
│ │ │ ├── ansible-elasticsearch
│ │ │ ├── ansible-kibana
│ │
│ │ ├── wazuh
│ │ │ ├── ansible-filebeat
│ │ │ ├── ansible-wazuh-manager
│ │ │ ├── ansible-wazuh-agent
│ │
│ │ ├── ansible-galaxy
│ │ │ ├── meta
│
│ ├── playbooks
│ │ ├── wazuh-agent.yml
│ │ ├── wazuh-elastic.yml
│ │ ├── wazuh-elastic_stack-distributed.yml
│ │ ├── wazuh-elastic_stack-single.yml
│ │ ├── wazuh-kibana.yml
│ │ ├── wazuh-manager.yml
│
│ ├── README.md
│ ├── VERSION
│ ├── CHANGELOG.md
Branches
stablebranch on correspond to the last Wazuh-Ansible stable version.masterbranch contains the latest code, be aware of possible bugs on this branch.
Testing
- Get the
wazuh-ansiblefolder from thewazuh-qarepository.
git clone https://github.com/wazuh/wazuh-qa
- Copy the
Pipfileand themoleculefolder into the root wazuh-ansible directory:
cp wazuh-qa/ansible/wazuh-ansible/* . -R
- Follow these steps for launching the tests. Check the Pipfile for running different scenarios:
pip install pipenv
sudo pipenv install
pipenv run test
pipenv run agent
Contribute
If you want to contribute to our repository, please fork our Github repository and submit a pull request.
If you are not familiar with Github, you can also share them through our users mailing list, to which you can subscribe by sending an email to wazuh+subscribe@googlegroups.com.
Modified by Wazuh
The playbooks have been modified by Wazuh, including some specific requirements, templates and configuration to improve integration with Wazuh ecosystem.
Credits and Thank you
Based on previous work from dj-wasabi.
https://github.com/dj-wasabi/ansible-ossec-server
License and copyright
WAZUH Copyright (C) 2016-2018 Wazuh Inc. (License GPLv2)