JINYA
Note that, in Ansible, ROLES are the ones that generate the configurations, Roles are made up of a task and one or more template file.
VARIABLE
time-zone {{ location.time_zone }};
FOR LOOP
{% for name_server in location.name_servers %}
{{ name_server }};
{% endfor %}
IF STATEMENTS
{% if item[0] is short_caption %}
{# do something here #}
{% endif %}
INCLUDING CONTENT OF FILES IN THE RENDERED TEMPLATE:
system{
{% include "login.j2" %}
{% include "services.j2" %}
}
INCLUDING BLOCKS:
Note that this is the parent configuration, having the section inside the block 'elegible' to be overriden.
services {
ssh;
{% block dhcp %}
dhcp{
pool 0.0.0.0/0;
}
{% endblock dhcp %}
}