From 9882dd56f6ad34579d3dc94efce5844c89b48dfb Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Tue, 3 Jul 2012 16:42:00 +0200 Subject: [PATCH] Allow variables in variables in templates --- lib/ansible/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py index 5fc640a284..15adb02939 100644 --- a/lib/ansible/utils.py +++ b/lib/ansible/utils.py @@ -279,13 +279,13 @@ def template_from_file(basedir, path, vars, setup_cache): ''' run a file through the templating engine ''' environment = jinja2.Environment(loader=jinja2.FileSystemLoader(basedir), trim_blocks=False) data = codecs.open(path_dwim(basedir, path), encoding="utf8").read() - template = environment.from_string(data) + t = environment.from_string(data) vars = vars.copy() vars['hostvars'] = setup_cache - res = template.render(vars) + res = t.render(vars) if data.endswith('\n') and not res.endswith('\n'): res = res + '\n' - return res + return template(res, vars, setup_cache) def parse_yaml(data): return yaml.load(data)