# Jinja2 control in playbook ?

**URL:** <https://forum.ansible.com/t/jinja2-control-in-playbook/11889>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [September 13, 2012, 11:57am UTC](https://forum.ansible.com/t/jinja2-control-in-playbook/11889 "2012-09-13T11:57:36Z")\
**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:** [September 13, 2012, 11:57am UTC](https://forum.ansible.com/t/jinja2-control-in-playbook/11889/1 "2012-09-13T11:57:36Z")

</div>

> Hello,
> 
> I have a question I couldn't answer reading this list.  
> Is it possible in a playbook to use Jinja2 control ?

Presently, it's not possible to slurp the contents of a file directly  
into a playbook.

What I proposed before, and we didn't implement yet, was to give a way  
for the basic templating code to load the contents from a file.

Basically I'm thinking of some magic syntax in the utils.template code like:

\<\<$path\>\>

This would be a super-trivial patch if someone wants to try to add it.

It might be nice to enable Jinja2 also, but Jinja2 itself is somewhat  
slow, and we execute the templating engine extremely often (calling it  
several  
times on very small strings), so I have a note to attempt to re-enable  
this and run some benchmarks.

I also do not want folks to think playbooks are legal to include any  
Jinja2 syntax, because if you start doing ifs and such in Jinja2,  
there are a lot of corner cases  
where people will tend to assume things work remotely or locally, and  
they'll get them wrong -- and in short, it will be confusing.

This is why Jinja2 syntax is currently confined to file templates.
