Created
December 14, 2021 08:00
-
-
Save jamesdube/c090dda20ab5340cd468af9eb5671db6 to your computer and use it in GitHub Desktop.
Extract all ip's from an ansible group
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: all | |
name: get group ips in one line | |
gather_facts: false | |
vars: | |
all_servers_ip: "{{groups['all'] | map('extract',hostvars,['ansible_ssh_host']) | join(',') }}" | |
tasks: | |
- debug: | |
msg: "{{all_servers_ip}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment