# Dynamic inventory group as a child of managed group - group\_vars unavailable

**URL:** <https://forum.ansible.com/t/dynamic-inventory-group-as-a-child-of-managed-group-group-vars-unavailable/15867>\
**Category:** Ansible Project\
**Created:** [August 6, 2014, 8:52am UTC](https://forum.ansible.com/t/dynamic-inventory-group-as-a-child-of-managed-group-group-vars-unavailable/15867 "2014-08-06T08:52:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ran](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@Ran](https://forum.ansible.com/u/Ran)\
**Post date:** [August 6, 2014, 8:52am UTC](https://forum.ansible.com/t/dynamic-inventory-group-as-a-child-of-managed-group-group-vars-unavailable/15867/1 "2014-08-06T08:52:30Z")

</div>

I cannot make an ec2 group (via dynamic inventory script) as a child of a managed group defined in hosts.

For example:

1. ec2 dynamic script returns a group of “tag\_worker\_1”

2. hosts file consists of:

[workercommon]

[tag\_worker\_1:children]  
workercommon

1. group\_vars has a file workercommon.yml which includes variables.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 6, 2014, 1:07pm UTC](https://forum.ansible.com/t/dynamic-inventory-group-as-a-child-of-managed-group-group-vars-unavailable/15867/2 "2014-08-06T13:07:59Z")

</div>

Please note the name of an ec2 tag group will be “ec2\_tag\_tagName\_tagValue” not “tag\_tagName\_value”. This is likely the problem.

Using the inventory scripts on the development branch, the tag “ec2\_tag\_tagName” will also be available containing everything with that tag.

Also, mixing dynamic inventory sources and INI files (crossing the streams) is really only a thing on the development branch thanks to a recent patch from @svg.

So I’d definitely recommend trying on 1.7 devel if not already, it will release very soon.

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [August 6, 2014, 1:16pm UTC](https://forum.ansible.com/t/dynamic-inventory-group-as-a-child-of-managed-group-group-vars-unavailable/15867/3 "2014-08-06T13:16:26Z")

</div>

> 2. hosts file consists of:
> 
> [workercommon]
> 
> [tag\_worker\_1:children]  
> workercommon
> 
> 3. group\_vars has a file workercommon.yml which includes variables.
> 
> -
> 
> The play's pattern references tag\_worker\_1 (the ec2 group). However the  
> variables from the "workercommon" group are not available.

​This is very logic, as your ec2 hosts are not member​ of workercommon, so  
they don't get those variables.

[workercommon:children]

> tag\_worker\_1
> 
> groups\_vars for workercommon will be available. This won't work for me  
> because I need to compose workercommon with other groups that will not  
> include tag\_worker\_1.

Hard to see from here but my guess is you can remodel your groups, and have  
an extra group to handle those differences.

Serge
