# Inventory group that consists of groups and hosts?

**URL:** <https://forum.ansible.com/t/inventory-group-that-consists-of-groups-and-hosts/25702>\
**Category:** Ansible Project\
**Created:** [October 9, 2017, 10:02am UTC](https://forum.ansible.com/t/inventory-group-that-consists-of-groups-and-hosts/25702 "2017-10-09T10:02:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 9, 2017, 10:02am UTC](https://forum.ansible.com/t/inventory-group-that-consists-of-groups-and-hosts/25702/1 "2017-10-09T10:02:29Z")

</div>

Hi

I'd like to define a group in my inventory that will include hosts as  
well as some groups.

For instance I have this in my inventory:

[squid]  
proxy-prod  
proxy-uat  
proxy-test

[testgroup]  
squid  
extrahost

If I run a playbook and use 'testgroup' for the hosts definition, I get:

[WARNING]: Found both group and host with same name: squid

If I change the inventory to use the children syntax:

[testgroup:children]  
squid  
extrahost

Then I get:

[testgroup:children] includes undefined group: extrahost

I can get this to work outside of the inventory, in my playbook:

&nbsp;&nbsp;hosts:  
&nbsp;&nbsp;&nbsp;&nbsp;- squid  
&nbsp;&nbsp;&nbsp;&nbsp;- eventr-uat

But then this collection of hosts isn't available in the inventory,  
and hence not to other roles etc.

Is it possible at all to have a 'mixed' group in the inventory?

Thanks

Dick

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 9, 2017, 11:07am UTC](https://forum.ansible.com/t/inventory-group-that-consists-of-groups-and-hosts/25702/2 "2017-10-09T11:07:47Z")

</div>

This should work

[squid]  
proxy-prod  
proxy-uat  
proxy-test

[testgroup]  
extrahost

[testgroup:children]  
squid
