# Unable to resolve variables from group\_vars

**URL:** <https://forum.ansible.com/t/unable-to-resolve-variables-from-group-vars/18512>\
**Category:** Ansible Project\
**Created:** [June 16, 2015, 10:15am UTC](https://forum.ansible.com/t/unable-to-resolve-variables-from-group-vars/18512 "2015-06-16T10:15:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srinivas](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Srinivas](https://forum.ansible.com/u/Srinivas)\
**Post date:** [June 16, 2015, 10:15am UTC](https://forum.ansible.com/t/unable-to-resolve-variables-from-group-vars/18512/1 "2015-06-16T10:15:30Z")

</div>

Hello All,

Here is my set-up.

- development

- inventory

- group\_vars

- webservers

- all.yml

- secret.yml- services

- all.yml- all.yml- webservers.yml

- services.yml

My inventory file looks like

[webservers]  
dev1

[services]  
dev1  
dev2

I have 2 play-books , webservers.yml which defines a set of roles for the webserver hosts to be executed and similarly another playbook services.yml for deploying some services.

When i try to execute **“ansible-playbook -i development webservers.yml”** i could able to resolve all the variable defined in the webservers directory under group var.  
But when i try to execute **“ansible-playbook -i development services.yml”** i could NOT able to resolve any variable defined in **“/group\_vars/services/all.yml”**. But if i keep the same variables in **“/group\_vars/all.yml”** the variables are resolving properly.

I have tried removing the folders in the group\_vars and specifying all the variables in webservers.yml and services.yml . But no luck.  
As per the ansible doc this should be supported. Could some one help me what is going wrong with the setup.

$ ansible --version  
ansible 1.6.6

Regards,  
Srinivas

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [June 16, 2015, 12:25pm UTC](https://forum.ansible.com/t/unable-to-resolve-variables-from-group-vars/18512/2 "2015-06-16T12:25:36Z")

</div>

Hi,

The group variables are checked in group\_vars/\<group\_name\> file so if you create a file group\_vars/webservers and place your variables it should appear. same for services,

- Benno

---

<div class="post-metadata">

**Author:** ![Srinivas](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Srinivas](https://forum.ansible.com/u/Srinivas)\
**Post date:** [June 16, 2015, 1:32pm UTC](https://forum.ansible.com/t/unable-to-resolve-variables-from-group-vars/18512/3 "2015-06-16T13:32:09Z")

</div>

Thanks Benno . Thats worked out.

The main mistake i was doing is creating the file with the name of the playbook but not with the host groups.
