template execution is monitored and explicitly whitelisted or blacklisted, whatever is preferred. This makes it possible to execute untrusted templates. Template Inheritance Makes it possible to use the same or a similar layout for all templates. Easy to Debug With a debug system that integrates template compile and runtime errors into the standard Python traceback system. Configurable Syntax For instance you can reconfigure Jinja2 to better fit output formats such as LaTeX or JavaScript. (skipped the features more relevant to high-volume usage such as in Django)
xml, html, etc Convention is to name files with .j2 extension http.conf.j2, sshd_config.j2 Convention to place in the templates/ directory templates/http.conf.j2, templates/sshd_config.j2
{{ ansible_date_time.epoch }} We can do math like {{ 1+3 }} Standard data types, like my list: {{ ('a','b','c') }} We can call standard methods associated with our types: {{ "lorem ipsum".upper() }} {{ ['a','b','c'].pop() }}
in iterable|sort(attribute='date') %} ... {% endfor %} Group by Attribute: {% for group in persons|groupby('gender') %} <li>{{ group.grouper }}<ul> {% for person in group.list %} <li>{{ person.first_name }}</li> {% endfor %}</ul></li> {% endfor %}