How to get lists of zabbix objects

The zabbix modules allow you to retrieve specific named objects, for example:

  • zabbix_host_info gets a specific host (using the required proxy_name parameter)
  • zabbix_template_info gets a specific template (using the required template_name parameter)

But as the xxx_name parameter is usually mandatory I do not see a way of getting a complete list of hosts or templates.

Am I overlooking something, is it possible to get lists of different zabbix objects?

(Using Community.Zabbix version 3.3.0, Ansible 2.17.12)

This sounds more like an inventory plugin (which community.zabbix also provides).

That should allow you to pull in all your objects as part of your inventory.

I don’t think zabbix_host_info requires any parameters. For example, there’s a test getting all hosts this way: community.zabbix/tests/integration/targets/test_zabbix_host_info/tasks/main.yml at main · ansible-collections/community.zabbix · GitHub

Thanks, you are right. My mistake about hosts. I still have the problem for other objects, e.g. templates and services, but I might be able to extract everything I need from a full list of hosts.

Thanks, the inventory plugin is a possibility. I’ll know as soon as I can get it working!

@plaxos glad you got it working.

Is there anything we could do to improve the documentation?

Nothing wrong with the documentation. My reading of it was less than perfect.

Isn’t this what lookup plugins are meant for? Would be nice if the zabbix collection would have those.
Something like query(‘community.zabbix.templates’) to get all templates, and query(‘community.zabbix.templates’, filter=foofoo) to apply filters.