Use the existing module_vars during the templating of module_vars
Since some of the vars contained in there may be used in the templating
of other variables. This also reverts e83a494
which originally fixed
issue #6979 but broke some other variable related things.
Fixes #6979
Fixes #7321
Fixes #7332
This commit is contained in:
parent
713657d684
commit
2e2e5d5321
2 changed files with 3 additions and 1 deletions
|
@ -855,5 +855,4 @@ class Play(object):
|
||||||
|
|
||||||
# finally, update the VARS_CACHE for the host, if it is set
|
# finally, update the VARS_CACHE for the host, if it is set
|
||||||
if host is not None:
|
if host is not None:
|
||||||
self.playbook.VARS_CACHE[host].update(self.vars)
|
|
||||||
self.playbook.VARS_CACHE[host].update(self.playbook.extra_vars)
|
self.playbook.VARS_CACHE[host].update(self.playbook.extra_vars)
|
||||||
|
|
|
@ -570,7 +570,10 @@ class Runner(object):
|
||||||
hostvars = HostVars(combined_cache, self.inventory, vault_password=self.vault_pass)
|
hostvars = HostVars(combined_cache, self.inventory, vault_password=self.vault_pass)
|
||||||
|
|
||||||
# use combined_cache and host_variables to template the module_vars
|
# use combined_cache and host_variables to template the module_vars
|
||||||
|
# we update the inject variables with the data we're about to template
|
||||||
|
# since some of the variables we'll be replacing may be contained there too
|
||||||
module_vars_inject = utils.combine_vars(combined_cache.get(host, {}), host_variables)
|
module_vars_inject = utils.combine_vars(combined_cache.get(host, {}), host_variables)
|
||||||
|
module_vars_inject.update(self.module_vars)
|
||||||
module_vars = template.template(self.basedir, self.module_vars, module_vars_inject)
|
module_vars = template.template(self.basedir, self.module_vars, module_vars_inject)
|
||||||
|
|
||||||
inject = {}
|
inject = {}
|
||||||
|
|
Loading…
Reference in a new issue