# Split inventory in multiple .yml files?

**URL:** <https://forum.ansible.com/t/split-inventory-in-multiple-yml-files/23875>\
**Category:** Ansible Project\
**Created:** [March 3, 2017, 3:45pm UTC](https://forum.ansible.com/t/split-inventory-in-multiple-yml-files/23875 "2017-03-03T15:45:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![belajzus](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@belajzus](https://forum.ansible.com/u/belajzus)\
**Post date:** [March 3, 2017, 3:45pm UTC](https://forum.ansible.com/t/split-inventory-in-multiple-yml-files/23875/1 "2017-03-03T15:45:40Z")

</div>

Hi,

is it possible to split inventory in multiple files…

eg.  
I have 3 projects on one virtual machine1, so I created group machine which consists of 3 subelements (projects), ProjectA, ProjectB and ProjectC

[Machine1]  
ProjectA ansible\_ssh\_host=machine1\_fqdn  
ProjectB ansible\_ssh\_host=machine1\_fqdn  
ProjectC ansible\_ssh\_host=machine1\_fqdn

So when I want to run some playbook I choose some (or all) of this projects.

But, my question is, is it possible to split ProjectA inventory file in multiple inventory files…  
Somehow include in it every \*.yml file in some specific folder…

eg.  
ProjectA **inventory** consists of every \*.yml file in ProjectA **folder**  
So my hosts\_vars would be:

ProjectA - file

ProjectA - folder

ProjectB - file

ProjectB - folder

ProjectC - file

ProjectC - folder

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Dennis\_Klein](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@Dennis\_Klein](https://forum.ansible.com/u/Dennis_Klein)\
**Post date:** [March 3, 2017, 3:54pm UTC](https://forum.ansible.com/t/split-inventory-in-multiple-yml-files/23875/2 "2017-03-03T15:54:05Z")

</div>

yes

have a look at this article: [http://allandenot.com/devops/2015/01/16/ansible-with-multiple-inventory-files.html](http://allandenot.com/devops/2015/01/16/ansible-with-multiple-inventory-files.html)

we are using it this way.  
`

`├── inventory │ ├── group_vars │ │ ├── all │ │ │ ├── vars.yml │ │ │ └── vault.yml │ └── host_vars │ ├──host1 │ │ │ ├── vars.yml │ │ │ └── vault.yml`

192.168.20.10  
`

---

<div class="post-metadata">

**Author:** ![belajzus](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@belajzus](https://forum.ansible.com/u/belajzus)\
**Post date:** [March 6, 2017, 10:40am UTC](https://forum.ansible.com/t/split-inventory-in-multiple-yml-files/23875/3 "2017-03-06T10:40:46Z")

</div>

Thank you Denis…that is what I needed

Dana petak, 3. ožujka 2017. u 16:54:06 UTC+1, korisnik Dennis Klein napisao je:
