I’m trying to use ansible to generate a file using nested templates, and I’m running into issues with
having the variables available to me in the nested templates. I’ll try to explain this concisely.
File ./hosts.yml:
I’m trying to use ansible to generate a file using nested templates, and I’m running into issues with
having the variables available to me in the nested templates. I’ll try to explain this concisely.
File ./hosts.yml:
What version of jinja2 are you running?
According to the docs[1], as of 2.1 this should work. Something else to try would be something like:
{% include incfile with context %}
Not sure if something would be disabling context, so maybe this would override that if that is indeed the problem.
[1] http://jinja.pocoo.org/docs/templates/#import-context-behavior
Running ansible 1.5 with Jinja2 2.7.2 on Debian 7. I should have mentioned - I did try the ‘with context’ change, but it made no difference.