0

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!

larsks
  • 43,623
  • 14
  • 121
  • 180
Alexander
  • 774
  • 2
  • 11
  • 20
  • 1
    It looks like the zabbix inventory plugin is exactly what you need. Can you show us how you've tried to use it? – larsks Oct 15 '22 at 21:43
  • Start with one of the examples you linked above, paste it in a `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 zabbix_inventory.yml ...`. For your firts steps, debugging and tunning, you might want to use instead `ansible-inventory -i zabbix_inventory.yml --list` just to see if you get the awaited result without trying to run a playbook. – Zeitounator Oct 23 '22 at 16:18

0 Answers0