From 918aa570ff4c1ff26018d66fe4a6539bc7176213 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Tue, 17 Sep 2019 20:03:25 +1000 Subject: [PATCH] Respect group_vars from other plugins The vars loader was optimisied to handle group_vars plugins but other plugins are used and are actually simpler to handle! --- lib/ansibleinventorygrapher/inventory.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansibleinventorygrapher/inventory.py b/lib/ansibleinventorygrapher/inventory.py index f42c238..10c2817 100755 --- a/lib/ansibleinventorygrapher/inventory.py +++ b/lib/ansibleinventorygrapher/inventory.py @@ -72,7 +72,7 @@ def _get_plugin_vars(self, plugin, path, entities): return data def get_group_vars(self, group): - return self._plugins_inventory([group]) + return group.get_vars() or self._plugins_inventory([group]) def get_host_vars(self, host): try: @@ -82,7 +82,8 @@ def get_host_vars(self, host): # play, host, task, include_hostvars, include_delegate_to magic_vars = ['ansible_playbook_python', 'groups', 'group_names', 'inventory_dir', 'inventory_file', 'inventory_hostname', 'inventory_hostname_short', - 'omit', 'playbook_dir', 'ansible_version', 'ansible_facts'] + 'omit', 'playbook_dir', 'ansible_version', 'ansible_facts', + 'ansible_host'] return {k: v for (k, v) in all_vars.items() if k not in magic_vars} def get_group(self, group_name):