# location of \`group\_vars/\` for included playbooks changed in 2.4+ ?

**URL:** <https://forum.ansible.com/t/location-of-group-vars-for-included-playbooks-changed-in-2-4/28378>\
**Category:** Ansible Project\
**Created:** [August 21, 2018, 8:15am UTC](https://forum.ansible.com/t/location-of-group-vars-for-included-playbooks-changed-in-2-4/28378 "2018-08-21T08:15:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riccardo\_Murri](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Riccardo\_Murri](https://forum.ansible.com/u/Riccardo_Murri)\
**Post date:** [August 21, 2018, 8:15am UTC](https://forum.ansible.com/t/location-of-group-vars-for-included-playbooks-changed-in-2-4/28378/1 "2018-08-21T08:15:03Z")

</div>

Hello,

I am updating some playbooks written initially for Ansible 2.2. and 2.3 to remove the features that were deprecated in Ansible 2.4+

The playbook is divided across multiple files, where `main.yml` would `include: roles/play_a.yml` (at playbook level), and then `play_a.yml` would call roles (e.g.) `a1`, `a2`, etc. Global variables are defined in `group_vars/all`, where `group_vars/` is a sibling of `main.yml`:

```auto
playbook_dir
>
+- main.yml
+- group_vars/
> >
> `- all
+- roles/
>
+- play_a.yml
+- a1/
+- a2/
...

```

Now, if I change playbook-level `include:` in `main.yml` to `import_playbook:` then group variables are no longer available to roles included in the play… I have to make an additional `group_vars/all` file in the `roles/` subdirectory.

Is this the expected behavior? Did I miss some important warning about the (relatively) new `import_playbook:` ?

Thanks,  
Riccardo

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [August 21, 2018, 2:34pm UTC](https://forum.ansible.com/t/location-of-group-vars-for-included-playbooks-changed-in-2-4/28378/2 "2018-08-21T14:34:19Z")

</div>

This is documented at [https://docs.ansible.com/ansible/devel/porting\_guides/porting\_guide\_2.4.html#initial-playbook-relative-group-vars-and-host-vars](https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.4.html#initial-playbook-relative-group-vars-and-host-vars)

Effectively, you want to make sure your group\_vars is relative to your inventory file, and not your playbook file.

---

<div class="post-metadata">

**Author:** ![Riccardo\_Murri](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Riccardo\_Murri](https://forum.ansible.com/u/Riccardo_Murri)\
**Post date:** [August 21, 2018, 9:19pm UTC](https://forum.ansible.com/t/location-of-group-vars-for-included-playbooks-changed-in-2-4/28378/3 "2018-08-21T21:19:31Z")

</div>

Thank you very much for your reply, Matt – indeed this was rather clearly documented in the 2.4 porting guide…

> Effectively, you want to make sure your group\_vars is relative to your inventory file, and not your playbook file.

Won’t be possible in my case (inventory is generated and placed in a temp directory, whereas group vars are effectively parts of the playbooks); I’ll see whether it’s better to maintain symlinks or switch to explicitly loading with `vars_files:`

Thanks,  
Riccardo
