Hi Everyone,
I’m trying to work out if something is possible. Imagine a playbook to configure a vpn mesh between a group of servers. If I created a group called ‘vpn’, then on each server I’d need to build template configs for each vpn tunnel with the server we’re writing the file one at one end and then all the other servers in the group at the other.
Therefore; is there a way to make a for loop either in the playbook or template that says:
(Excuse my pseudocode)
{% for host in groups[‘vpn’] except [‘thishost’] %}
vpn left side = {{ hostvars[thishost].ansible_hostname }}
vpn right side = {{ hostvars[host].ansible_hostname }}
{% endfor %}
Hope that makes sense…
Steve