Score:0

Ansibe to install/update Zabbix agents on hosts listed in Zabbix server

us flag

I have a lot of VMs set up by hands during years, so each VM is a bit unique (so to say, you know). Zabbix agents on these VMs are of different versions and maybe differently configured.

The idea is to use Ansible to install commonly configured Zabbix agents on all of these VMs. Now I'd like to fill Ansible inventory with hosts from Zabbix server host list - and it would be pretty good idea to use this host list dynamically.

So the question is, if I can use Zabbix host list instead of "-i host" list and do that in some standard way?

I can find this but I can't figure out how to use it in my case. And most Google queries for "Ansible over Zabbix server host list" entries are about setting up Zabbix server or agents with Ansible, not about dynamic host list.

All I can imagine is to create host list statically with SQL query to Zabbix DB (or Zabbix API) but this seems to be "my own buggy way" to do thing which is already done by someone.

Please advice or maybe give some example!

pt flag
It looks like the zabbix inventory plugin is exactly what you need. Can you show us how you've tried to use it?
Zeitounator avatar
fr flag
Start with one of the examples you linked above, paste it in a `<whatever_>zabbix_inventory.yml` file which will become your inventory, make sure you installed the required libs on the controller and start using your inventory with `ansible-playbook -i <whatever_>zabbix_inventory.yml ...`. For your firts steps, debugging and tunning, you might want to use instead `ansible-inventory -i <whatever_>zabbix_inventory.yml --list` just to see if you get the awaited result without trying to run a playbook.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.