mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove this check as it wasn't really needed and in recent refinements keeps the group_vars stuff from working
as desired.
This commit is contained in:
parent
492953f299
commit
396b81b647
1 changed files with 7 additions and 6 deletions
|
@ -196,14 +196,9 @@ class Play(object):
|
|||
|
||||
def _update_vars_files_for_host(self, host):
|
||||
|
||||
if (host is not None) and (not host in self.playbook.SETUP_CACHE):
|
||||
# no need to process failed hosts or hosts not in this play
|
||||
return
|
||||
|
||||
if type(self.vars_files) != list:
|
||||
self.vars_files = [ self.vars_files ]
|
||||
|
||||
|
||||
|
||||
if (host is not None):
|
||||
inventory = self.playbook.inventory
|
||||
hostrec = inventory.get_host(host)
|
||||
|
@ -214,10 +209,12 @@ class Play(object):
|
|||
path = os.path.join(basedir, "group_vars/%s" % x)
|
||||
if os.path.exists(path):
|
||||
data = utils.parse_yaml_from_file(path)
|
||||
print "GROUPFILE: %s" % data
|
||||
self.playbook.SETUP_CACHE[host].update(data)
|
||||
path = os.path.join(basedir, "host_vars/%s" % hostrec.name)
|
||||
if os.path.exists(path):
|
||||
data = utils.parse_yaml_from_file(path)
|
||||
print "HOSTFILE: %s" % data
|
||||
self.playbook.SETUP_CACHE[host].update(data)
|
||||
|
||||
for filename in self.vars_files:
|
||||
|
@ -241,11 +238,13 @@ class Play(object):
|
|||
if self._has_vars_in(filename2) and not self._has_vars_in(filename3):
|
||||
# this filename has variables in it that were fact specific
|
||||
# so it needs to be loaded into the per host SETUP_CACHE
|
||||
print "VF1 UPDATE: %s" % data
|
||||
self.playbook.SETUP_CACHE[host].update(data)
|
||||
self.playbook.callbacks.on_import_for_host(host, filename4)
|
||||
elif not self._has_vars_in(filename4):
|
||||
# found a non-host specific variable, load into vars and NOT
|
||||
# the setup cache
|
||||
print "VF2 UPDATE: %s" % data
|
||||
self.vars.update(data)
|
||||
elif host is not None:
|
||||
self.playbook.callbacks.on_not_import_for_host(host, filename4)
|
||||
|
@ -274,7 +273,9 @@ class Play(object):
|
|||
if host is not None and self._has_vars_in(filename2) and not self._has_vars_in(filename3):
|
||||
# running a host specific pass and has host specific variables
|
||||
# load into setup cache
|
||||
print "VF3 update: %s" % new_vars
|
||||
self.playbook.SETUP_CACHE[host].update(new_vars)
|
||||
elif host is None:
|
||||
# running a non-host specific pass and we can update the global vars instead
|
||||
print "VF4 update: %s" % new_vars
|
||||
self.vars.update(new_vars)
|
||||
|
|
Loading…
Reference in a new issue