diff options
author | James Cammarata <jimi@sngx.net> | 2014-09-25 21:46:16 +0200 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2014-09-25 21:46:16 +0200 |
commit | 128c10b3111b3bb6f0fac8bbbeddc8b2766ecbf7 (patch) | |
tree | 622b1c336e0107d4b377408221048be4d02500ab /lib | |
parent | Fix action_plugins for modules not respecting check mode (diff) | |
download | ansible-128c10b3111b3bb6f0fac8bbbeddc8b2766ecbf7.tar.xz ansible-128c10b3111b3bb6f0fac8bbbeddc8b2766ecbf7.zip |
Don't template 'vars' dictionary during templating
Fixes #9132
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/utils/template.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index d102659003..9521f2f2ec 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -166,6 +166,7 @@ class _jinja2_vars(object): return False def __getitem__(self, varname): + from ansible.runner import HostVars if varname not in self.vars: for i in self.extras: if varname in i: @@ -175,8 +176,9 @@ class _jinja2_vars(object): else: raise KeyError("undefined variable: %s" % varname) var = self.vars[varname] - # HostVars is special, return it as-is - if isinstance(var, dict) and type(var) != dict: + # HostVars is special, return it as-is, as is the special variable + # 'vars', which contains the vars structure + if isinstance(var, dict) and varname == "vars" or isinstance(var, HostVars): return var else: return template(self.basedir, var, self.vars, fail_on_undefined=self.fail_on_undefined) |