I'm trying to understand variable precedence in Ansible - more exactly the 
part about host_vars and group_vars in inventory or playbook. My layout 
looks like this:

production/
├── inventory (alfa, beta and gamma hosts)
├── group_vars/
│   └── all (foo=1)
└── host_vars/
    └── alfa (foo=2)
playbooks/
├── site.yml (debuging variable foo)
├── group_vars/
│   └── all (foo=10)
└── host_vars/
    └── beta (foo=20)

So I have three nodes (alfa, beta and gamma) and foo variable. When I start 
a play I get this result:

alfa foo=2
beta foo=20
gamma foo=10



According to documentation the precedence should be following:

   1. inventory group_vars
   2. inventory host_vars
   3. playbook group_vars
   4. playbook host_vars


But my result looks like the precedence is following:


   1. inventory group_vars
   2. playbook group_vars
   3. inventory host_vars
   4. playbook host_vars


Did I misunderstand something? Or is it a mistake in documentation? I'm 
using Ansible 2.0.1 but even 1.9.3 yields same result.

-- 
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/5cb88dca-ef0f-4a75-aea9-bd8f9b8ce962%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to