-
-
Save drybjed/2bebf672e0f9255acf08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for host in groups['gluster_servers'] %} | |
{% if host != inventory_hostname %} | |
{% if 'ansible_' + rhel7_interface in hostvars[host] %} | |
- {{ hostvars[host]['ansible_' + rhel7_interface]['ipv4']['address'] }} | |
{% else %} | |
- {{ hostvars[host]['ansible_' + default_interface]['ipv4']['address'] }} | |
{% endif %} | |
{% endif %} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: gluster_servers | |
vars: | |
rhel7_interface: enp0s3 | |
default_interface: eth0 | |
tasks: | |
- set_fact: | |
other_servers: "{{ lookup('template', 'lookup.j2') | from_yaml }}" | |
- debug: | |
msg: "addresses to use: {{ other_servers | join(',') }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment