Created
March 2, 2016 20:44
-
-
Save RafPe/8d576b68bf9d4132667e to your computer and use it in GitHub Desktop.
Ansible - IP addresses of all hosts in group
This file contains hidden or 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: all | |
| vars: | |
| - allips: | | |
| {% set comma = joiner(",") %} | |
| {% for host in groups['mygroup'] -%} | |
| {{ comma() }}{{ hostvars[host]['ansible_eth0']['ipv4']['address']}} | |
| {%- endfor -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment