Skip to content

Commit

Permalink
zabbix_host_facts: get list of templates (#50007)
Browse files Browse the repository at this point in the history
Get list of templates among other items. It is useful because later one can edit this list using zabbix_host module.
  • Loading branch information
mindrb authored and ansibot committed Jan 9, 2019
1 parent 33d8882 commit 260285a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ansible/modules/monitoring/zabbix/zabbix_host_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_hosts_by_host_name(self, host_name, exact_match):
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:
Expand All @@ -124,6 +124,7 @@ def get_hosts_by_ip(self, host_ips):
host = self._zapi.host.get({
'output': 'extend',
'selectGroups': 'extend',
'selectParentTemplates': ['name'],
'hostids': hostinterface['hostid']
})
host[0]['hostinterfaces'] = hostinterface
Expand Down

0 comments on commit 260285a

Please sign in to comment.