From 260285a73fee530c6b28b102b4519c3f1845b8fb Mon Sep 17 00:00:00 2001 From: mindrb <45540803+mindrb@users.noreply.github.com> Date: Wed, 9 Jan 2019 12:12:32 +0200 Subject: [PATCH] zabbix_host_facts: get list of templates (#50007) Get list of templates among other items. It is useful because later one can edit this list using zabbix_host module. --- lib/ansible/modules/monitoring/zabbix/zabbix_host_facts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_host_facts.py b/lib/ansible/modules/monitoring/zabbix/zabbix_host_facts.py index 92e120efb33..a8b0184a462 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_host_facts.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_host_facts.py @@ -103,7 +103,7 @@ class Host(object): search_key = 'search' if exact_match: search_key = 'filter' - host_list = self._zapi.host.get({'output': 'extend', search_key: {'host': [host_name]}}) + host_list = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], search_key: {'host': [host_name]}}) if len(host_list) < 1: self._module.fail_json(msg="Host not found: %s" % host_name) else: @@ -124,6 +124,7 @@ class Host(object): host = self._zapi.host.get({ 'output': 'extend', 'selectGroups': 'extend', + 'selectParentTemplates': ['name'], 'hostids': hostinterface['hostid'] }) host[0]['hostinterfaces'] = hostinterface