Unable to resolve variables from group_vars

57 views
Skip to first unread message

Srinivas

unread,
Jun 16, 2015, 8:10:20 AM6/16/15
to ansible...@googlegroups.com
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

benno joy

unread,
Jun 16, 2015, 8:25:40 AM6/16/15
to ansible...@googlegroups.com
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




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3ffec194-b1a4-4599-a2ed-d76f641aae9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

srini

unread,
Jun 16, 2015, 9:32:33 AM6/16/15
to ansible...@googlegroups.com
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. 


For more options, visit https://groups.google.com/d/optout.



--
Regards,
Srinivas Jill
9704808885
Reply all
Reply to author
Forward
0 new messages