mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
revert ocalhost getting 'all' vars (#31425)
back to previous implicit localhost behaviour fixes #31420
This commit is contained in:
parent
e4c61ea9a1
commit
a9942353fe
3 changed files with 9 additions and 11 deletions
|
@ -79,9 +79,6 @@ class InventoryData(object):
|
|||
else:
|
||||
new_host = Host(pattern)
|
||||
|
||||
# use 'all' vars but not part of all group
|
||||
new_host.vars = self.groups['all'].get_vars()
|
||||
|
||||
new_host.address = "127.0.0.1"
|
||||
new_host.implicit = True
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ class Host:
|
|||
results['inventory_hostname_short'] = self.name.split('.')[0]
|
||||
results['group_names'] = sorted([g.name for g in self.get_groups() if g.name != 'all'])
|
||||
|
||||
return combine_vars(self.vars, results)
|
||||
return results
|
||||
|
||||
def get_vars(self):
|
||||
return combine_vars(self.vars, self.get_magic_vars())
|
||||
|
|
|
@ -319,14 +319,15 @@ class VariableManager:
|
|||
data[group] = combine_vars(data[group], _plugins_play(group))
|
||||
return data
|
||||
|
||||
# Merge as per precedence config
|
||||
# Merge groups as per precedence config, if not implicit localhost
|
||||
# only allow to call the functions we want exposed
|
||||
for entry in C.VARIABLE_PRECEDENCE:
|
||||
if entry in self._ALLOWED:
|
||||
display.debug('Calling %s to load vars for %s' % (entry, host.name))
|
||||
all_vars = combine_vars(all_vars, locals()[entry]())
|
||||
else:
|
||||
display.warning('Ignoring unknown variable precedence entry: %s' % (entry))
|
||||
if not host.implicit:
|
||||
for entry in C.VARIABLE_PRECEDENCE:
|
||||
if entry in self._ALLOWED:
|
||||
display.debug('Calling %s to load vars for %s' % (entry, host.name))
|
||||
all_vars = combine_vars(all_vars, locals()[entry]())
|
||||
else:
|
||||
display.warning('Ignoring unknown variable precedence entry: %s' % (entry))
|
||||
|
||||
# host vars, from inventory, inventory adjacent and play adjacent via plugins
|
||||
all_vars = combine_vars(all_vars, host.get_vars())
|
||||
|
|
Loading…
Reference in a new issue