# Dynamic Inventory in 2.0 with children

**URL:** <https://forum.ansible.com/t/dynamic-inventory-in-2-0-with-children/20641>\
**Category:** Ansible Project\
**Created:** [February 20, 2016, 6:44pm UTC](https://forum.ansible.com/t/dynamic-inventory-in-2-0-with-children/20641 "2016-02-20T18:44:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruce\_Freeman](https://avatars.discourse-cdn.com/v4/letter/b/b2d939/32.png) [@Bruce\_Freeman](https://forum.ansible.com/u/Bruce_Freeman)\
**Post date:** [February 20, 2016, 6:44pm UTC](https://forum.ansible.com/t/dynamic-inventory-in-2-0-with-children/20641/1 "2016-02-20T18:44:23Z")

</div>

I’m seeing a difference in dynamic inventory between 1.9.4 and 2.0 but what we have seems to be correct according to the documentation.

Here is a simple Shell script to demonstrate:

#!/bin/sh  
cat \<\<!  
{  
“fooservers”: {  
“children”: [“fooA”, “fooB”]  
},  
“fooA”: [“host1”],  
“fooB”: [“host2”]  
}

!

If I put this in a directory as inventory/test.sh then I see the following:

With Ansible 1.9.4:

$ ansible --version

ansible 1.9.4  
configured module search path = None

$ ansible --list-hosts -i inventory fooservers  
host1  
host2

With Ansible 2.0:

$ ansible --version  
ansible 2.0.0.2  
config file = /var/tmp/playbook/ansible.cfg  
configured module search path = Default w/o overrides  
$ ansible --list-hosts -i inventory fooservers  
hosts (1):  
fooservers

It looks like in 2.0 the group of groups isn’t getting expanded. Did the syntax of how children get specified change in 2.0?

I discovered that if I add an empty hosts or vars then it works:

#!/bin/sh  
cat \<\<!  
{  
“fooservers”: {  
“hosts”: ,  
“children”: [“fooA”, “fooB”]  
},  
“fooA”: [“host1”],  
“fooB”: [“host2”]  
}

!

$ ansible -i inventory --list-hosts fooservers  
hosts (2):  
host1  
host2

– Bruce

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 20, 2016, 7:48pm UTC](https://forum.ansible.com/t/dynamic-inventory-in-2-0-with-children/20641/2 "2016-02-20T19:48:39Z")

</div>

​It seems you found a bug…​
