Set 'hostvars' before performing variable replacements

This commit is contained in:
Daniel Néri 2012-05-13 20:36:08 +02:00
parent 60d44e1a01
commit 4b0480dd9d

View file

@ -257,8 +257,8 @@ def varReplace(raw, vars):
def template(text, vars, setup_cache, no_engine=True):
''' run a text buffer through the templating engine '''
vars = vars.copy()
text = varReplace(unicode(text), vars)
vars['hostvars'] = setup_cache
text = varReplace(unicode(text), vars)
if no_engine:
# used when processing include: directives so that Jinja is evaluated
# in a later context when more variables are available