From 3caadca3f493db6fbec5410db32dc430c8f50fec Mon Sep 17 00:00:00 2001 From: sky-joker Date: Mon, 23 Dec 2019 16:47:02 +0900 Subject: [PATCH] Include groups in name-based search results (#66026) add changelogs --- changelogs/fragments/66026-zabbix_host_info.yml | 2 ++ lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/66026-zabbix_host_info.yml diff --git a/changelogs/fragments/66026-zabbix_host_info.yml b/changelogs/fragments/66026-zabbix_host_info.yml new file mode 100644 index 00000000000..ccd5014dcff --- /dev/null +++ b/changelogs/fragments/66026-zabbix_host_info.yml @@ -0,0 +1,2 @@ +minor_changes: + - zabbix_host_info - ``host_name`` based search results now include host groups. diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py b/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py index 86d6756292d..a43c1036572 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py @@ -120,7 +120,7 @@ class Host(object): if exact_match: search_key = 'filter' host_list = self._zapi.host.get({'output': 'extend', 'selectParentTemplates': ['name'], search_key: {'host': [host_name]}, - 'selectInventory': host_inventory}) + 'selectInventory': host_inventory, 'selectGroups': 'extend'}) if len(host_list) < 1: self._module.fail_json(msg="Host not found: %s" % host_name) else: