From 72e1716f29fbd25f0aa98fdbe36eaa959ea805ed Mon Sep 17 00:00:00 2001 From: sky-joker Date: Fri, 31 Jan 2020 00:07:40 +0900 Subject: [PATCH] Fix to gather facts include macro and tag (#66947) --- .../modules/monitoring/zabbix/zabbix_host_info.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py b/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py index b8fa00fa29a..33e19f9596a 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py @@ -125,8 +125,15 @@ class Host(object): search_key = 'search' if exact_match: search_key = 'filter' - host_list = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], search_key: {'host': [host_name]}, - 'selectInventory': host_inventory, 'selectGroups': 'extend'}) + host_list = self._zapi.host.get({ + 'output': 'extend', + 'selectParentTemplates': ['name'], + search_key: {'host': [host_name]}, + 'selectInventory': host_inventory, + 'selectGroups': 'extend', + 'selectTags': 'extend', + 'selectMacros': 'extend' + }) if len(host_list) < 1: self._module.fail_json(msg="Host not found: %s" % host_name) else: @@ -149,7 +156,9 @@ class Host(object): 'selectGroups': 'extend', 'selectParentTemplates': ['name'], 'hostids': hostinterface['hostid'], - 'selectInventory': host_inventory + 'selectInventory': host_inventory, + 'selectTags': 'extend', + 'selectMacros': 'extend' }) host[0]['hostinterfaces'] = hostinterface host_list.append(host[0])