Templates with Jinja2

In the previous section, we used variables with the Jinja2 syntax of {{ variable }}. While you can do a lot of complex things in Jinja2, luckily, we only need some of the basic things to get started.

Jinja2 (http://jinja.pocoo.org/) is a full-featured, powerful template engine that originated in the Python community. It is widely used in Python web frameworks such as Django and Flask.

For now, it is enough to just keep in mind that Ansible utilizes Jinja2 as the template engine. We will revisit the topics of Jinja2 filters, tests, and lookups as the situations call for them. You can find more information on the Ansible Jinja2 template here: http://docs.ansible.com/ansible/playbooks_templating.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset