# Is splitting of the inventory possible?

**URL:** <https://forum.ansible.com/t/is-splitting-of-the-inventory-possible/24908>\
**Category:** Ansible Project\
**Created:** [July 6, 2017, 6:36am UTC](https://forum.ansible.com/t/is-splitting-of-the-inventory-possible/24908 "2017-07-06T06:36:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.lehmann](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@thomas.lehmann](https://forum.ansible.com/u/thomas.lehmann)\
**Post date:** [July 6, 2017, 6:36am UTC](https://forum.ansible.com/t/is-splitting-of-the-inventory-possible/24908/1 "2017-07-06T06:36:45Z")

</div>

Hi,

assume we would have 1000 projects in a big company and an OPS guys  
tells us to copy every detail for provisioning for qa, dev and prod in one  
repository. Some told arguments:

- just to clone one repository
- all Unix machines require a basic setup and therefore the concrete inventory file has to have all hosts and roles  
(the intention is to maintain the host names at multiple locations)  
a) Is this the way to go or is there a better solution?

b) when a) could you please provide examples (url’s) where to read?

Kind Regards,  
Thomas

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [July 6, 2017, 6:50am UTC](https://forum.ansible.com/t/is-splitting-of-the-inventory-possible/24908/2 "2017-07-06T06:50:15Z")

</div>

Try setting up one inventory for QA, another for DEV, and a third for  
production.  
You can use the same playbooks with different inventories so it'll keep the  
environments isolated but you'll get better consistency between each env.

---

<div class="post-metadata">

**Author:** ![thomas.lehmann](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@thomas.lehmann](https://forum.ansible.com/u/thomas.lehmann)\
**Post date:** [July 6, 2017, 7:24am UTC](https://forum.ansible.com/t/is-splitting-of-the-inventory-possible/24908/3 "2017-07-06T07:24:23Z")

</div>

We have that but it does not answer my question. We still would have **one inventory file** with all hosts for 1000 projects per qa, dev and prod, right?  
(we have less than 1000 … is just a forced example)

Is it possible to organize … that OPS can “walk” all hosts also the repository has - if possible - splittet all details per team (or per component) - for  
better readability without being forced to run the playbook several times?

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [July 6, 2017, 7:43am UTC](https://forum.ansible.com/t/is-splitting-of-the-inventory-possible/24908/4 "2017-07-06T07:43:57Z")

</div>

If you have 250 hosts with the same roles applied to them,  
then yes I'd go with that.

You can make the inventories less huge depending on your naming convention  
by using regexes , e.g.

[webservers]  
www[01:250].example.com

Or if you'd rather you can have multiple static inventory files in a single  
inventory folder, that works too. Ansible loads them all to get the  
list of hosts,  
so that might fit better with what you're trying to do.
