I think that's the issue I reported here:
https://github.com/ansible/ansible/issues/11996
Initially closed as a "possible misunderstanding", then acknowledged as
broken on 1.9 and fixed on 2.0, then broken again on 2.0, and the issue
was left closed. Seems pretty clear to me that it's not the wanted behavior.
See also:
https://groups.google.com/d/msg/ansible-project/4OIuDxRSv0M/RgW8HkuIKQAJ
On 10/2/15 6:06 AM, t goto wrote:
Hello, experts.
Let me ask you about weird behavior between include_vars and role
variable.
I have a couple of roles, "test_before" and "test_after"
|
.
`-- test_before
|-- tasks
| `--main.yml
`-- vars
`--RedHat.yml
|--test_after
||--tasks
||`-- main.yml
| `--vars
|`-- main.yml
|
First role reads OS specific variables.
Main task file and OS specific variable file follow.
test_before/tasks/main.yml
|
---
-name:Addthe OS specific variables
include_vars:"{{ ansible_os_family }}.yml"
-debug:message="{{item}}"
with_items:packages
|
test_before/vars/RedHat.yml
|
---
packages:
-alpha
-bravo
|
On the otherhand, second role reads role's main.yml like following.
test_after/tasks/main.yml
|
---
-debug:message="{{item}}"
with_items:packages
|
test_after/vars/main.yml
|
---
packages:
-yankee
-zulu
|
I intended running those roles displays "alpha, bravo" from first
role, then "yankee, zulu" from second role, but both role display
"alpha, bravo", just like second role didn't read vars/main.yml.
|
PLAY
[overridetest]**********************************************************
TASK:[test_before |Addthe OS specific
variables]**********************************
ok:[10.10.14.3]
TASK:[test_before |debug
message="{{item}}"]***************************************
ok:[10.10.14.3]=>(item=alpha)=>{
"item":"alpha",
"msg":"Hello world!"
}
ok:[10.10.14.3]=>(item=bravo)=>{
"item":"bravo",
"msg":"Hello world!"
}
TASK:[test_after |debug
message="{{item}}"]*********************************
ok:[10.10.14.3]=>(item=alpha)=>{
"item":"alpha",
"msg":"Hello world!"
}
ok:[10.10.14.3]=>(item=bravo)=>{
"item":"bravo",
"msg":"Hello world!"
|
Is my intention wrong or there's something else I should've look after?
Thank you.
--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d02cdddc-222f-4d71-9a0c-ab6baf7750c0%40googlegroups.com
<https://groups.google.com/d/msgid/ansible-project/d02cdddc-222f-4d71-9a0c-ab6baf7750c0%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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/560ED60D.1010306%40gmail.com.
For more options, visit https://groups.google.com/d/optout.