--- - 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: "Check if client.keys exists" stat: path=/var/ossec/etc/client.keys register: check_keys tags: - config - name: "Register client" shell: /var/ossec/bin/agent-auth -m {{ ossec_server_ip }} -p 1515 when: ossec_register_client == true and check_keys.stat.size == 0 tags: - config - name: "Installing the 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 Manager 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"