48 lines
1.1 KiB
YAML
48 lines
1.1 KiB
YAML
---
|
|
- include: "RedHat.yml"
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
- include: "Debian.yml"
|
|
when: ansible_os_family == "Debian"
|
|
|
|
- name: Install wazuh-agent
|
|
package: name=wazuh-agent state=present
|
|
tags:
|
|
- init
|
|
|
|
- name: "Register agent"
|
|
shell: /var/ossec/bin/agent-auth -m {{ wazuh_manager_ip }} -p {{ wazuh_authd_port }}
|
|
register: agent_auth_output
|
|
when: wazuh_register_client == true
|
|
tags:
|
|
- config
|
|
|
|
- name: "Verify agent registration"
|
|
shell: echo {{ agent_auth_output }} | grep "Valid key created"
|
|
when: wazuh_register_client == true
|
|
tags:
|
|
- config
|
|
|
|
- name: "Installing agent configuration (ossec.conf)"
|
|
template: src=var-ossec-etc-ossec-agent.conf.j2
|
|
dest=/var/ossec/etc/ossec.conf
|
|
owner=root
|
|
group=ossec
|
|
mode=0644
|
|
notify: restart wazuh-agent
|
|
tags:
|
|
- init
|
|
- config
|
|
|
|
- name: Ensure Wazuh Agent service is started and enabled
|
|
service:
|
|
name: wazuh-agent
|
|
enabled: yes
|
|
state: started
|
|
|
|
- include: "RMRedHat.yml"
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
- include: "RMDebian.yml"
|
|
when: ansible_os_family == "Debian"
|