Interview Prep/Ansible/Jinja2, Conditionals and Loops

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.

All Ansible questions Roadmap: Ansible

More on Jinja2, Conditionals and Loops