Hi all,

I'm having trouble putting variables in the right places. I don't believe 
the documentation actually states where Ansible will look for the variables 
and i have hit and miss some.
Currently using ansible 1.9.2 on CentOS 7.
Tree structure is as follows:
ansible.cfg
hosts
group_vars/
  all
host_vars/
  hostname1
playbooks/
  play1.yml
roles/
  role1/
    tasks/
      main.yml
    templates/
      template1.j2
...

when i run ansible-playbook playbooks/play1.yml which creates a file from 
template1.j2, it is giving me an error saying variable is undefined. The 
variable is defined in host_vars/hostname1 and the hosts file only has 
hostname1 in it. However if I were to define the same variable in 
group_vars/all, it works.

I'm wondering if there's a way to see which file or folder ansible is 
reading to look for a particular variable.

I previously found out that the group_vars will required to be on the same 
directory as the hosts file (or whatever you configure the inventory file 
is). I would assume that the host_vars/ will require to sit on the same 
level.

Thanks.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/55a59e53-1c1a-4608-afa2-68c914068451%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to