What role does Jinja2 play in Ansible?
BeginnerConceptJinja2, Conditionals and Loops
Answer
Jinja2 is the templating engine used everywhere Ansible evaluates an expression: variables in YAML ("{{ var }}"), conditions in when, and whole files rendered by the template module. Rendering happens on the control node before anything is sent to the target.
Because of that, templates can use inventory data, other hosts' facts through hostvars, lookups and filters, none of which exist on the managed node.
More on Jinja2, Conditionals and Loops
What are the three Jinja2 delimiters?BeginnerShow a template with a loop and a conditional, and how it is deployed.BeginnerWhich filters do you use every day?BeginnerHow do you transform lists and dicts with filters (`map`, `select`, `selectattr`, `unique`, `flatten`)?IntermediateHow does `when` work and which operators can you use?BeginnerHow do you combine several conditions?Beginner