# How to get lists of zabbix objects

**URL:** <https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137>\
**Category:** Get Help\
**Tags:** zabbix\
**Created:** [June 3, 2025, 3:22pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137 "2025-06-03T15:22:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![plaxos](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@plaxos](https://forum.ansible.com/u/plaxos)\
**Post date:** [June 3, 2025, 3:22pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/1 "2025-06-03T15:22:26Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [June 3, 2025, 3:41pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/2 "2025-06-03T15:41:47Z")

</div>

This sounds more like an inventory plugin (which [community.zabbix](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_inventory_inventory.html#ansible-collections-community-zabbix-zabbix-inventory-inventory) also provides).

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

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [June 3, 2025, 3:59pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/3 "2025-06-03T15:59:33Z")

</div>

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](https://github.com/ansible-collections/community.zabbix/blob/main/tests/integration/targets/test_zabbix_host_info/tasks/main.yml#L137-L139)

---

<div class="post-metadata">

**Author:** ![plaxos](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@plaxos](https://forum.ansible.com/u/plaxos)\
**Post date:** [June 4, 2025, 8:00pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/4 "2025-06-04T20:00:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![plaxos](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@plaxos](https://forum.ansible.com/u/plaxos)\
**Post date:** [June 4, 2025, 8:01pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/5 "2025-06-04T20:01:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gundalow](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gundalow/32/99_2.png) [@gundalow](https://forum.ansible.com/u/gundalow)\
**Post date:** [June 5, 2025, 6:37am UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/6 "2025-06-05T06:37:00Z")

</div>

@plaxos glad you got it working.

Is there anything we could do to improve the documentation?

---

<div class="post-metadata">

**Author:** ![plaxos](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@plaxos](https://forum.ansible.com/u/plaxos)\
**Post date:** [June 5, 2025, 12:30pm UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/7 "2025-06-05T12:30:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ildjarn](https://avatars.discourse-cdn.com/v4/letter/i/8491ac/32.png) [@ildjarn](https://forum.ansible.com/u/ildjarn)\
**Post date:** [June 6, 2025, 7:16am UTC](https://forum.ansible.com/t/how-to-get-lists-of-zabbix-objects/43137/8 "2025-06-06T07:16:11Z")

</div>

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.
