# Retrieve group children

**URL:** <https://forum.ansible.com/t/retrieve-group-children/19927>\
**Category:** Ansible Project\
**Created:** [December 3, 2015, 10:41am UTC](https://forum.ansible.com/t/retrieve-group-children/19927 "2015-12-03T10:41:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurent\_DEVIGNES](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@Laurent\_DEVIGNES](https://forum.ansible.com/u/Laurent_DEVIGNES)\
**Post date:** [December 3, 2015, 10:41am UTC](https://forum.ansible.com/t/retrieve-group-children/19927/1 "2015-12-03T10:41:20Z")

</div>

I don’t know how to retrieve simply group children

I have this structure  
[group1]  
foo1  
foo2

[group2]  
bar1  
bar2

[group3]  
baz1  
baz2

[MetaGroupA:children]  
group1  
group2

[MetaGroupB:children]  
group3

For some goup\_vars, I just want to loop for each group of MetaGroups, but don’t want to loop on hosts

Could you give me way to achieve this ? (with a “for” loop ?)

Regards

---

<div class="post-metadata">

**Author:** ![Andrew\_Edelstein](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Andrew\_Edelstein](https://forum.ansible.com/u/Andrew_Edelstein)\
**Post date:** [December 3, 2015, 3:52pm UTC](https://forum.ansible.com/t/retrieve-group-children/19927/2 "2015-12-03T15:52:05Z")

</div>

They don’t work that way.  
[MetaGroupA:chldren]  
group1  
group2

is effectively  
[MetaGroupA]  
foo1  
foo2  
bar1  
bar2

So trying to loop over MetaGroupA WILL loop over all the hosts in the child groups.
