# Location of host and group configuration

**URL:** <https://forum.ansible.com/t/location-of-host-and-group-configuration/22444>\
**Category:** Ansible Project\
**Created:** [September 1, 2016, 9:09am UTC](https://forum.ansible.com/t/location-of-host-and-group-configuration/22444 "2016-09-01T09:09:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uwe\_Sauter](https://avatars.discourse-cdn.com/v4/letter/u/41988e/32.png) [@Uwe\_Sauter](https://forum.ansible.com/u/Uwe_Sauter)\
**Post date:** [September 1, 2016, 9:09am UTC](https://forum.ansible.com/t/location-of-host-and-group-configuration/22444/1 "2016-09-01T09:09:54Z")

</div>

Hi all,

I'm currently struggling with how to tell Ansible where it can find host\_vars and group\_vars folders. Is there an environmet  
variable for it? Does it have to be inside the same folder as the playbook?

Regards,

&nbsp;&nbsp;Uwe

---

<div class="post-metadata">

**Author:** ![ankur.cool](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@ankur.cool](https://forum.ansible.com/u/ankur.cool)\
**Post date:** [September 1, 2016, 10:29am UTC](https://forum.ansible.com/t/location-of-host-and-group-configuration/22444/2 "2016-09-01T10:29:45Z")

</div>

It can be inside the same folder as the playbook.

root  
– group\_vars/all.yml  
– host\_vars/some\_host.yml  
– myPlaybook.yml

---

<div class="post-metadata">

**Author:** ![Uwe\_Sauter](https://avatars.discourse-cdn.com/v4/letter/u/41988e/32.png) [@Uwe\_Sauter](https://forum.ansible.com/u/Uwe_Sauter)\
**Post date:** [September 1, 2016, 10:39am UTC](https://forum.ansible.com/t/location-of-host-and-group-configuration/22444/3 "2016-09-01T10:39:17Z")

</div>

Yes, that I've alredy figured out. But what if I want to group my playbooks inside different folders but the group and host vars  
should be the same? Is there an option to tell Ansible where to look for those folders?

I imagine a dir tree like:

.  
├── group\_vars  
│ ├── group1.yaml  
│ └── group2.yaml  
├── host\_vars  
│ ├── host1.yaml  
│ ├── host2.yaml  
│ └── localhost.yaml  
├── group1-playbooks  
│ ├── 00-requirements.yaml  
│ ├── 01-copy-static-files.yaml  
│ └── 99-cleanup.yaml  
├── group2-playbooks  
│ ├── 00-requirements.yaml  
│ ├── 01-copy-static-files.yaml  
│ └── 99-cleanup.yaml  
└── inventory

Regards,

&nbsp;&nbsp;Uwe

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 1, 2016, 11:25am UTC](https://forum.ansible.com/t/location-of-host-and-group-configuration/22444/4 "2016-09-01T11:25:54Z")

</div>

I don't think that is possible. You need to have the group\_vars and host\_vars in the inventory directory or the playbook directory.  
group\_vars and host\_vars in the playbook directory will overwrite those in the inventory directory if both exist.
