Ansible playbooks and configuration templates to deploy and configure a Zabbix Agent on Linux.
- Ansible 2.9 or later.
- Access to one or more Linux servers where Zabbix Agent will be installed.
- A configured Zabbix server to accept and process data from agents.
git clone https://github.com/kenftt/zabbix-agent-ansible.git
cd zabbix-agent-ansible
Edit the hosts.ini
file to list your target servers with their IP addresses or hostnames.
If not already done, generate an SSH key pair with RSA encryption and a bit length of 4096:
ssh-keygen -t rsa -b 4096
Copy the public key to the target host (zabbix-host) using ssh-copy-id:
ssh-copy-id <username>@zabbix-host
Replace <username>
with the appropriate username on the remote host if different.
Create a file named secret.yml
using Ansible Vault to store the sudo password:
ansible-vault create secret.yml
Inside secret.yml
, add the following YAML content, replacing <YourSudoPassword>
with the actual sudo password:
ansible_become_password: <YourSudoPassword>
Remember to keep the secret.yml
file secure and do not expose it to unauthorized users.
ansible-playbook -i hosts.ini install-zabbix-agent.yml --ask-vault-pass
This command will prompt you to enter the vault password (secret.yml
) before executing the playbook.