Just in case if the problem is still there,
You can refer to ansible inventory through ‘hostvars’
, ‘group_names’
, and ‘groups’
ansible variables.
Example:
To be able to get ip addresses of all servers within group "mygroup", use the below construction:
- debug: msg="{{ hostvars[item]['ansible_eth0']['ipv4']['address'] }}"
with_items:
- "{{ groups['mygroup'] }}"