This is a topology to use Ansible to automatically install Wazuh agent.
![This image has an empty alt attribute; its file name is image-460.png](https://tungle.ca/wp-content/uploads/2022/01/image-460.png)
On Debian server, edit sshd_configle file to allow root login and restart Opensshd daemon.
vi /etc/ssh/sshd_config Add the line “PermitRootLogin yes”
![](https://tungle.ca/wp-content/uploads/2022/02/image-65.png)
![](https://tungle.ca/wp-content/uploads/2022/02/image-67.png)
On LinutMint Ansible Controller.
![](https://tungle.ca/wp-content/uploads/2022/02/image-68.png)
Configure to access SSH daemon on Debian server via public key authentication.
Next, we need to set up Public key authentication on LinuxMint.
ssh-keygen -b 4096
![](https://tungle.ca/wp-content/uploads/2022/02/image-69.png)
Copy the key to the Debian server that you want to access.
![](https://tungle.ca/wp-content/uploads/2022/02/image-70.png)
![](https://tungle.ca/wp-content/uploads/2022/02/image-71.png)
![](https://tungle.ca/wp-content/uploads/2022/02/image-72.png)
Modify hosts on Ansible.
![](https://tungle.ca/wp-content/uploads/2022/02/image-73.png)
Create Wazuh file under /etc/ansible/group_vars.
ansible_ssh user:root
![](https://tungle.ca/wp-content/uploads/2022/02/image-74.png)
cd /etc/ansible/roles/
sudo git clone --branch v4.2.5 https://github.com/wazuh/wazuh-ansible.git
ls
![](https://tungle.ca/wp-content/uploads/2022/02/image-75.png)
![](https://tungle.ca/wp-content/uploads/2022/02/image-76.png)
Create Wazuh.yml file under /etc/ansible
---
- hosts: Wazuh
roles:
- /etc/ansible/roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent
vars:
wazuh_managers:
- address: 192.168.5.34
port: 1514
protocol: udp
api_port: 55000
api_proto: 'http'
api_user: ansible
wazuh_agent_authd:
registration_address: 192.168.5.31
enable: true
port: 1515
ssl_agent_ca: null
ssl_auto_negotiate: 'no'
![](https://tungle.ca/wp-content/uploads/2022/02/image-78.png)
Run ansible to test on Debian host.
ansible -m ping Wazuh -i /etc/ansible/hosts
![](https://tungle.ca/wp-content/uploads/2022/02/image-79.png)
Run ansible-playbook to install wazuh agent on Linux Debian server.
ansible-playbook -i /etc/ansible/hosts Wazuh.yml -u root
![](https://tungle.ca/wp-content/uploads/2022/02/image-80.png)
![](https://tungle.ca/wp-content/uploads/2022/02/image-81.png)