July 2017
Intermediate to advanced
266 pages
6h 36m
English
Jinja2 is not limited to strictly computational operations. It can be leveraged for any number of operational tasks. Ansible has kindly also provided a number of handy filters, which can be applied to our variable implementations.
The following is a table with a set of examples for the more popular operational tasks one might need to perform using Jinja filter expressions:
| Expression name | Example | Description of the expression |
| to_json |
{{ some_variable | to_json }} |
Converts the variable data into JSON format and renders it. |
| to_yaml |
{{ some_variable | to_yaml }} |
Converts the variable data into YAML format and renders it. |
| mandatory |
{{ variable | mandatory }} |
Makes the variable declaration and setting mandatory ... |
Read now
Unlock full access