What are the three Jinja2 delimiters?
BeginnerConceptJinja2, Conditionals and Loops
Answer
{{ ... }}— expression, prints a value{% ... %}— statement:if,for,set,macro{# ... #}— comment, not rendered
{# nginx upstream #}
upstream app {
{% for h in groups['app'] %}
server {{ hostvars[h]['ansible_host'] }}:8080;
{% endfor %}
}
More on Jinja2, Conditionals and Loops
What role does Jinja2 play in Ansible?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