Hello,
I have got situation, where I needed to change last item in the host group for template.
{% for host in groups[‘application_srv’] %}
{% if groups[‘application_srv’].index(inventory_hostname) == -1 %}
'app@{{ hostvars[host]['ansible_fqdn'] }}'
{% else %}
'app@{{ hostvars[host]['ansible_fqdn'] }}',
{% endif %}
{% endfor %}
But this does not working. Maybe someone can, to use host_group item and then loop thru the index as last one