mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Keep hostvars from being templated
This commit is contained in:
parent
e3f7f86ac4
commit
c200c26ced
1 changed files with 6 additions and 1 deletions
|
@ -248,7 +248,12 @@ class _jinja2_vars(object):
|
||||||
def __getitem__(self, varname):
|
def __getitem__(self, varname):
|
||||||
if varname not in self.vars:
|
if varname not in self.vars:
|
||||||
raise KeyError("undefined variable: %s" % varname)
|
raise KeyError("undefined variable: %s" % varname)
|
||||||
return template_ds(self.basedir, self.vars[varname], self.vars)
|
var = self.vars[varname]
|
||||||
|
# HostVars is special, return it as-is
|
||||||
|
if isinstance(var, dict) and type(var) != dict:
|
||||||
|
return var
|
||||||
|
else:
|
||||||
|
return template_ds(self.basedir, var, self.vars)
|
||||||
|
|
||||||
def template_from_file(basedir, path, vars):
|
def template_from_file(basedir, path, vars):
|
||||||
''' run a file through the templating engine '''
|
''' run a file through the templating engine '''
|
||||||
|
|
Loading…
Reference in a new issue