# ansible2.4: playbook group\_vars/\* no longer loaded into hostvars

**URL:** <https://forum.ansible.com/t/ansible2-4-playbook-group-vars-no-longer-loaded-into-hostvars/25995>\
**Category:** Ansible Project\
**Created:** [November 10, 2017, 5:19pm UTC](https://forum.ansible.com/t/ansible2-4-playbook-group-vars-no-longer-loaded-into-hostvars/25995 "2017-11-10T17:19:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brano\_Zarnovican](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@Brano\_Zarnovican](https://forum.ansible.com/u/Brano_Zarnovican)\
**Post date:** [November 10, 2017, 5:19pm UTC](https://forum.ansible.com/t/ansible2-4-playbook-group-vars-no-longer-loaded-into-hostvars/25995/1 "2017-11-10T17:19:31Z")

</div>

Hi,

upgrade-ing to Ansible 2.4, I have noticed that variables defined in ‘group\_vars/all.yaml’, ‘group\_vars/groupX.yaml’ no longer appear in ‘hostvars’. I’m talking about referencing hostvars of _another_ host from currently executing one.

I have the following directory structure:

.  
├── env  
│ ├── dev  
│ │ ├── group\_vars  
│ │ │ └── all.yaml  
│ │ └── inventory  
│ └── prod  
│ ├── group\_vars  
│ │ └── all.yaml  
│ └── inventory  
├── group\_vars  
│ └── all.yaml  
└── site.yaml

Only the variables defined at “inventory” level group\_vars propagate to hostvars. This behavior has changed between 2.3-2.4.

In Ansible 2.3, if I needed a variable in hostvars to be define for all environments, I would put it to ‘group\_vars/all.yaml’. Now I have to duplicate it to all inventory’s group\_vars, which is … suboptimal.

Q: is there any place (in Ansible2.4) where you could define “inventory variable defaults”, common for all environments/inventories ??

Regards,

BranoZ

---

<div class="post-metadata">

**Author:** ![Rich\_Fletcher](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@Rich\_Fletcher](https://forum.ansible.com/u/Rich_Fletcher)\
**Post date:** [November 17, 2017, 2:20am UTC](https://forum.ansible.com/t/ansible2-4-playbook-group-vars-no-longer-loaded-into-hostvars/25995/2 "2017-11-17T02:20:39Z")

</div>

I see this behavior too (in 2.4.1). On searching, one tends to find a lot of “Ansible used to resolve group\_vars and host\_vars from the current directory; now it doesn’t; don’t do that”. But that isn’t my problem, or yours I wager.

My suspicion is that it seems to be a problem with playbook-adjacent (group|host)\_vars files that only is seen when specifying a inventory directory (additionally, possibly, specifying inventory files in a subdirectory). Single inventory files often tend to be in the same directory as playbooks, so it muddies the water sometimes when testing this. It almost seems like ever since support was added for (group|host)\_vars files adjacent to inventory, the playbook-adjacent setup is not tested as much (despite the best practices page and other documentation).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 17, 2017, 4:57pm UTC](https://forum.ansible.com/t/ansible2-4-playbook-group-vars-no-longer-loaded-into-hostvars/25995/3 "2017-11-17T16:57:03Z")

</div>

see if this if fixed in the upcoming 2.4.2, I believe this  
[https://github.com/ansible/ansible/pull/32269](https://github.com/ansible/ansible/pull/32269) PR solves the corner  
cases that prevented play adjacent group/host vars from being picked  
up
