summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2014-05-08 13:09:36 -0500
committerJames Cammarata <jimi@sngx.net>2014-05-21 14:56:59 -0500
commit8851ceaa9e9ad6e5052ba8186094fe4fc605f9a2 (patch)
tree5515c240940507bb0804552bcf7acf8cbd93835e
parent854bf142222a0c35e43223da8aa8c423b37c1ebd (diff)
downloadansible-8851ceaa9e9ad6e5052ba8186094fe4fc605f9a2.tar.gz
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
-rw-r--r--lib/ansible/playbook/play.py1
-rw-r--r--lib/ansible/runner/__init__.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py
index eb3d3ad63e..1465e3f2a1 100644
--- a/lib/ansible/playbook/play.py
+++ b/lib/ansible/playbook/play.py
@@ -855,5 +855,4 @@ class Play(object):
# finally, update the VARS_CACHE for the host, if it is set
if host is not None:
- self.playbook.VARS_CACHE[host].update(self.vars)
self.playbook.VARS_CACHE[host].update(self.playbook.extra_vars)
diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py
index ca8b118912..cd47a0340c 100644
--- a/lib/ansible/runner/__init__.py
+++ b/lib/ansible/runner/__init__.py
@@ -570,7 +570,10 @@ class Runner(object):
hostvars = HostVars(combined_cache, self.inventory, vault_password=self.vault_pass)
# 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.update(self.module_vars)
module_vars = template.template(self.basedir, self.module_vars, module_vars_inject)
inject = {}