I have already an installation guide, on how to install the zabbix agent on linux servers here. Here I show how to create an ansible playbook, which automates the installation.
Functionality of the playbook
Installs zabbix agent version 5.2 (handled by a variable)
works on Ubuntu 20.04 and...
First we need a file, which contains the secrets. In my example the file is calles “secrets_demo.enc” and contains originally the following content:
This file needs to be encrypted by ansible vault:
ansible-vault encrypt secrets.enc
As Debian takes the Ansibe repository of Ubuntu, the following line has to be appended at /etc/apt/sources.list
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --...