mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
33d888210b
commit
260285a73f
1 changed files with 2 additions and 1 deletions
|
@ -103,7 +103,7 @@ class Host(object):
|
||||||
search_key = 'search'
|
search_key = 'search'
|
||||||
if exact_match:
|
if exact_match:
|
||||||
search_key = 'filter'
|
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:
|
if len(host_list) < 1:
|
||||||
self._module.fail_json(msg="Host not found: %s" % host_name)
|
self._module.fail_json(msg="Host not found: %s" % host_name)
|
||||||
else:
|
else:
|
||||||
|
@ -124,6 +124,7 @@ class Host(object):
|
||||||
host = self._zapi.host.get({
|
host = self._zapi.host.get({
|
||||||
'output': 'extend',
|
'output': 'extend',
|
||||||
'selectGroups': 'extend',
|
'selectGroups': 'extend',
|
||||||
|
'selectParentTemplates': ['name'],
|
||||||
'hostids': hostinterface['hostid']
|
'hostids': hostinterface['hostid']
|
||||||
})
|
})
|
||||||
host[0]['hostinterfaces'] = hostinterface
|
host[0]['hostinterfaces'] = hostinterface
|
||||||
|
|
Loading…
Reference in a new issue