Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect group_vars from other plugins #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/ansibleinventorygrapher/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down