On 17 April 2015 at 17:31, Sandra Parsick <sandra.kosma...@googlemail.com>
wrote:

> So my question, why my expectation is wrong?
>


​yes, it's a feature, not a bug :)
Io just answered the same question on
https://github.com/ansible/ansible/issues/10755, so copy pasting my answer:

This is a feature and not a bug, and has been asked several times yet here
and on the list. You are trying to use a way to define things that just
isn't the way ansible dpes things.

Ansible only uses variables on the host level. The inventory only returns
variables after they are calculated/inherited down top that host level.

When you target a play to a particular group, that gets calculated down to
a list of hosts. Whether you call groupA or groupB here, it results in the
same host. And that hosts only has one particular value for myvar, which
happens to be groupB because thats the last one bing parsed.

To quote the docs:

Remember: Child groups override parent groups, and hosts always override
their groups.

​

    Serge

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEhzMJAfUH3G%2B-vEDttkDduxE-vFBb_gxtjyxLVqmVjRmVGDQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to