# hosts\_vars subdirectories

**URL:** <https://forum.ansible.com/t/hosts-vars-subdirectories/26152>\
**Category:** Ansible Developer\
**Created:** [November 28, 2017, 2:58pm UTC](https://forum.ansible.com/t/hosts-vars-subdirectories/26152 "2017-11-28T14:58:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_G](https://avatars.discourse-cdn.com/v4/letter/v/49beb7/32.png) [@Vincent\_G](https://forum.ansible.com/u/Vincent_G)\
**Post date:** [November 28, 2017, 2:58pm UTC](https://forum.ansible.com/t/hosts-vars-subdirectories/26152/1 "2017-11-28T14:58:44Z")

</div>

Hi folks,

Is there a way to organize the host\_vars directory into subdirectories ?  
If not, where to ask for it ?

We have a large number of hosts (500+) and our usage actually suffer from this flat organization.

I would suggest to treat any files from /hosts\_vars/_/_ to be treated as they where sitting at the top level /host\_vars/  
So we could organize our hosts\_vars by location/role (I’m _not_ referring to the group\_vars… that we intensively use in conjunction !) :  
hosts\_vars/

- boston  
– (list of baremetal in boston)
- newyork  
– (list of baremetal in newyork)
- clients  
– (list of clients’s VM)  
(… and so on)

If someone knows a hack or point me to the right direction to adapt ansible to that, we will be glad to post a MR !

If this has already been discussed, please point me to the thread so I can convince you from my user story to allow that 🙂

Regards,

Vincent

---

<div class="post-metadata">

**Author:** ![ljenkin](https://avatars.discourse-cdn.com/v4/letter/l/cc9497/32.png) [@ljenkin](https://forum.ansible.com/u/ljenkin)\
**Post date:** [December 16, 2017, 9:06am UTC](https://forum.ansible.com/t/hosts-vars-subdirectories/26152/2 "2017-12-16T09:06:31Z")

</div>

Sounds like your trying to implement group\_vars,

I would group hosts in your inventory and and use group\_vars. Its much more scalable and robust than using host\_vars. Ideally (for me) host\_vars are only used in test environments until the relevant groups are sorted out.

Have a look at [http://docs.ansible.com/ansible/latest/playbooks\_best\_practices.html#how-to-differentiate-staging-vs-production](http://docs.ansible.com/ansible/latest/playbooks_best_practices.html#how-to-differentiate-staging-vs-production) for how that might work.
