diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 6e8893e2c8..42f5612a5b 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -275,6 +275,16 @@ def template_from_file(basedir, path, vars): raise errors.AnsibleError("unable to process as utf-8: %s" % realpath) except: raise errors.AnsibleError("unable to read %s" % realpath) + + # Get jinja env overrides from template + if data.startswith('#env:'): + eol = data.find('\n') + line = data[5:eol] + data = data[eol+1:] + for pair in line.split(','): + (key,val) = pair.split(':') + setattr(environment,key.strip(),val.strip()) + t = environment.from_string(data) vars = vars.copy() try: