Skip to content

Instantly share code, notes, and snippets.

@Kickimanjaro
Last active March 21, 2021 01:01
Show Gist options
  • Save Kickimanjaro/aa48f27e657a556bf81dfae95f52f847 to your computer and use it in GitHub Desktop.
Save Kickimanjaro/aa48f27e657a556bf81dfae95f52f847 to your computer and use it in GitHub Desktop.
This creates a list of all the IP addresses I want from a hostgroup. I want to exclude the local host from this list on each node. Is this possible in the template file or must I combine with another task to remove the unwanted value?
...
unicast_peer {
{% for host in groups['loadbalancers'] %}
{{ hostvars[host]['ansible_default_ipv4']['address'] }}
{% endfor %}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment