# Minor change to template handling of "include:" loaded files in playbooks

**URL:** <https://forum.ansible.com/t/minor-change-to-template-handling-of-include-loaded-files-in-playbooks/11498>\
**Category:** Ansible Project\
**Created:** [May 4, 2012, 3:39am UTC](https://forum.ansible.com/t/minor-change-to-template-handling-of-include-loaded-files-in-playbooks/11498 "2012-05-04T03:39:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 4, 2012, 3:39am UTC](https://forum.ansible.com/t/minor-change-to-template-handling-of-include-loaded-files-in-playbooks/11498/1 "2012-05-04T03:39:37Z")

</div>

TL/DR – include files are not Jinja2 templates. You can ignore this if you didn’t know that they used to be. Wanted to share though  
in case this throws anyone. If you don’t understand, you definitely can skip this.

Longer explanation –

In order to make certain variables like this:

{{ ansible\_fact\_here }}

actually work with includes…

Included files in playbooks are not “pure” Jinja2 templates any more.

This means that they are templated just like playbooks, meaning each line is templated (more or less).

this is still fine:

action: whatever {{ foo }}

but now this is not:

{{ %for }}

- action: whatever …  
{{ %endfor }}

I don’t think this really is going to break anyone, except for clever folks who figured out that included files  
were technically Jinja2 templates. If you need loops, with\_items does that, if you need conditionals, ‘only\_if’  
does that.

Now included files are just YAML, which is what they were before anyway, and things work consistently  
as they do in top level playbooks.

This was a fix to enable complex fact usage, among other things, in included files. $ansible\_factname worked  
but {{ ansible\_factname }} did not, and this fixes that.

–Michael
