Skip to content

Instantly share code, notes, and snippets.

@RafPe
Created March 2, 2016 20:44
Show Gist options
  • Select an option

  • Save RafPe/8d576b68bf9d4132667e to your computer and use it in GitHub Desktop.

Select an option

Save RafPe/8d576b68bf9d4132667e to your computer and use it in GitHub Desktop.
Ansible - IP addresses of all hosts in group
---
- 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