# Get other hosts group vars

**URL:** <https://forum.ansible.com/t/get-other-hosts-group-vars/20129>\
**Category:** Ansible Project\
**Created:** [January 5, 2016, 2:13pm UTC](https://forum.ansible.com/t/get-other-hosts-group-vars/20129 "2016-01-05T14:13:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![geoffrey.montel](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@geoffrey.montel](https://forum.ansible.com/u/geoffrey.montel)\
**Post date:** [January 5, 2016, 2:13pm UTC](https://forum.ansible.com/t/get-other-hosts-group-vars/20129/1 "2016-01-05T14:13:28Z")

</div>

Hello everyone !

I’m digging into Ansible capabilities a bit further, and I’m looking to implement with a beautiful manner the concept of VIP.  
To do so, I implemented this variable in the group\_vars of my inventory:

group\_vars/firstcluster :

`  
vips:

- name: cluster1\_vip  
ip : 1.2.3.4
- name: cluster1.othervip  
ip : 1.2.3.5  
`

group\_vars/secondcluster :

`  
vips:

- name: cluster2\_vip  
ip : 1.2.4.4
- name: cluster2.othervip  
ip : 1.2.4.5  
`

and in the inventory :

`  
[firstcluster]  
node10  
node11

[secondcluster]  
node20  
node21  
`

My question : if I want to set up a DNS server, that gathers all the VIP and associated names (_without redundancy_ for esthetism) , how do I proceed ? In short : is it possible to get all group variables notwithstanding the hosts underneath ?

like :

`{% for group in <THEMAGICVAR> %} {% for vip in group.vips %} {{ vip.name }} IN A {{ vip.ip }} {% end for %} {% end for %}`

Thank you very much !

– Geoff
