|
|
|
@ -268,7 +268,7 @@ class Templar:
|
|
|
|
|
# Clearing cache
|
|
|
|
|
self._cached_result = {}
|
|
|
|
|
|
|
|
|
|
def template(self, variable, convert_bare=False, preserve_trailing_newlines=True, escape_backslashes=True, fail_on_undefined=None, overrides=None, convert_data=True):
|
|
|
|
|
def template(self, variable, convert_bare=False, preserve_trailing_newlines=True, escape_backslashes=True, fail_on_undefined=None, overrides=None, convert_data=True, static_vars = ['']):
|
|
|
|
|
'''
|
|
|
|
|
Templates (possibly recursively) any given data as input. If convert_bare is
|
|
|
|
|
set to True, the given data will be wrapped as a jinja2 variable ('{{foo}}')
|
|
|
|
@ -340,7 +340,10 @@ class Templar:
|
|
|
|
|
# we don't use iteritems() here to avoid problems if the underlying dict
|
|
|
|
|
# changes sizes due to the templating, which can happen with hostvars
|
|
|
|
|
for k in variable.keys():
|
|
|
|
|
d[k] = self.template(variable[k], preserve_trailing_newlines=preserve_trailing_newlines, fail_on_undefined=fail_on_undefined, overrides=overrides)
|
|
|
|
|
if k not in static_vars:
|
|
|
|
|
d[k] = self.template(variable[k], preserve_trailing_newlines=preserve_trailing_newlines, fail_on_undefined=fail_on_undefined, overrides=overrides)
|
|
|
|
|
else:
|
|
|
|
|
d[k] = variable[k]
|
|
|
|
|
return d
|
|
|
|
|
else:
|
|
|
|
|
return variable
|
|
|
|
|