# In v2.4.x.x how can I include host groups in one inventory file to another? If so how?

**URL:** <https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207>\
**Category:** Ansible Project\
**Created:** [December 5, 2017, 4:42pm UTC](https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207 "2017-12-05T16:42:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [December 5, 2017, 4:42pm UTC](https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207/1 "2017-12-05T16:42:57Z")

</div>

Say I have inventory files that look like this

`  
host\_vars/bitbucket\_servers

---

<div class="post-metadata">

**Author:** ![Larry\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Larry\_Smith1](https://forum.ansible.com/u/Larry_Smith1)\
**Post date:** [December 6, 2017, 5:15am UTC](https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207/2 "2017-12-06T05:15:48Z")

</div>

Why not just create one inventory like below?

/inventory/hosts.inv  
`  
[bb-gerrit-cluster:children]  
bb-cluster1  
gerrit-cluster1

[bb-cluster1]  
[www.bb-loc1.domain.com](http://www.bb-loc1.domain.com)  
[www.bb-loc2.domain.com](http://www.bb-loc2.domain.com)

[gerritt-cluster1]  
[www.gerritt-loc1.domain.com](http://www.gerritt-loc1.domain.com)  
[www.gerritt-loc2.comain.com](http://www.gerritt-loc2.comain.com)

[jira-cluster1]  
[www.jira-loc1.domain.com](http://www.jira-loc1.domain.com)  
[www.jira-loc2.comain.com](http://www.jira-loc2.comain.com)  
`

And then create your folder structure like:

`inventory/`  
`inventory/hosts.inv`  
`inventory/group_vars/`  
`inventory/group_vars/bb-cluster1`  
`inventory/group_vars/gerritt-cluster1`  
`inventory/group_vars/jira-cluster1`  
`inventory/host_vars`  
`inventory/host_vars/xxxxxxxx`

Not sure if this would meet your requirements but this would be much cleaner IMHO. But maybe not? As I am not sure what your requirements are.

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [December 6, 2017, 9:16am UTC](https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207/3 "2017-12-06T09:16:07Z")

</div>

Definitely a single inventory file is NOT what I want/need, but thanks.

---

<div class="post-metadata">

**Author:** ![Larry\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Larry\_Smith1](https://forum.ansible.com/u/Larry_Smith1)\
**Post date:** [December 6, 2017, 3:49pm UTC](https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207/4 "2017-12-06T15:49:15Z")

</div>

Cool. No worries. However, I would be interested in hearing your use case. Always interesting to hear others perspective on how to use inventory, group vars, and host vars.

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [December 6, 2017, 4:08pm UTC](https://forum.ansible.com/t/in-v2-4-x-x-how-can-i-include-host-groups-in-one-inventory-file-to-another-if-so-how/26207/5 "2017-12-06T16:08:34Z")

</div>

In my case, I have different servers represented in their respective inventory files - bitbucket, gerrit, atlassian, etc. I need to set up group variables that are common to some, but NOT all.
