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. |
||
|---|---|---|
| .. | ||
| defaults | ||
| handlers | ||
| meta | ||
| tasks | ||
| templates | ||
| vars | ||
| README.md | ||
Ansible Playbook - Wazuh agent
This role will install and configure a Wazuh Agent.
OS Requirements
This role is compatible with:
- Red Hat
- CentOS
- Fedora
- Debian
- Ubuntu
Role Variables
wazuh_managers: Collection of Wazuh Managers' IP address, port, and protocol used by the agentwazuh_agent_authd: Collection with the settings to register an agent using authd.
Playbook example
The following is an example of how this role can be used:
- hosts: all:!wazuh-manager
roles:
- ansible-wazuh-agent
vars:
wazuh_managers:
- address: 127.0.0.1
port: 1514
protocol: tcp
api_port: 55000
api_proto: 'http'
api_user: 'ansible'
wazuh_agent_authd:
registration_address: 127.0.0.1
enable: true
port: 1515
ssl_agent_ca: null
ssl_auto_negotiate: 'no'
License and copyright
WAZUH Copyright (C) 2018 Wazuh Inc. (License GPLv3)
Based on previous work from dj-wasabi
Modified by Wazuh
The playbooks have been modified by Wazuh, including some specific requirements, templates and configuration to improve integration with Wazuh ecosystem.