mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
better logic for all-group variables for implicit localhost
This commit is contained in:
parent
3c06833302
commit
0ab721d51e
1 changed files with 1 additions and 4 deletions
|
@ -324,6 +324,7 @@ class Inventory(object):
|
||||||
if ungrouped is None:
|
if ungrouped is None:
|
||||||
self.add_group(Group('ungrouped'))
|
self.add_group(Group('ungrouped'))
|
||||||
ungrouped = self.get_group('ungrouped')
|
ungrouped = self.get_group('ungrouped')
|
||||||
|
self.get_group('all').add_child_group(ungrouped)
|
||||||
ungrouped.add_host(new_host)
|
ungrouped.add_host(new_host)
|
||||||
return new_host
|
return new_host
|
||||||
|
|
||||||
|
@ -452,10 +453,6 @@ class Inventory(object):
|
||||||
|
|
||||||
vars = {}
|
vars = {}
|
||||||
|
|
||||||
# special case for ungrouped hosts, make sure group_vars/all is loaded
|
|
||||||
if len(host.groups) == 1 and host.groups[0].name == 'ungrouped':
|
|
||||||
vars = self.get_group_variables('all', vault_password=self._vault_password)
|
|
||||||
|
|
||||||
# plugin.run retrieves all vars (also from groups) for host
|
# plugin.run retrieves all vars (also from groups) for host
|
||||||
vars_results = [ plugin.run(host, vault_password=vault_password) for plugin in self._vars_plugins if hasattr(plugin, 'run')]
|
vars_results = [ plugin.run(host, vault_password=vault_password) for plugin in self._vars_plugins if hasattr(plugin, 'run')]
|
||||||
for updated in vars_results:
|
for updated in vars_results:
|
||||||
|
|
Loading…
Reference in a new issue