Hello list,

I need to understand following variable precedence problem. 
I have an inventory file with following group hierarchy:
# inventory file
host1
host2

[group1]
host1
host2

[group11:children]
group1

[group12:children]
group1

In the group_var files of group *group11* and *group12, *a variable *var* 
is defined with different value:
# content of group_vars/group11
var: "group11"

# content of group_vars/group12
var: "group12"

Furthermore, I have two playbooks that evaluate the variable *var *. One 
playbook is for the host group *group11* and the second playbook is for 
*group12*

#content of playbook site-group11.yml
- hosts: group11
  tasks:
    - debug: var=var

#content of playbook site-group12.yml
- hosts: group12
  tasks:
    - debug: var=var


When I run both playbooks, I get the following output from both:

< TASK: debug var=var >
 ---------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


ok: [host1] => {
    "var": {
        "var": "group12"
    }
}
ok: [host2] => {
    "var": {
        "var": "group12"
    }
}

This output is ok for the playbook site-group12.yml. But my expectation is 
that the variable *var* has the value *group11* in playbook site-group11.yml 
.

So my question, why my expectation is wrong?

Best regards,

Sandra

-- 
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/e8a4f05d-608e-4478-9bd1-73e04162b82e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to