Thanks for info, Dan. Glad to see that at least someone is already working on it :), and it probably will be fixed in ver2. I'm going to remove the "include_vars" from playbook until Ansible 2.0 arrives!
Thank you! 2015年10月3日土曜日 4時08分08秒 UTC+9 Dan Stillman: > > 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: Add the 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 [override test] > ********************************************************** > > > TASK: [test_before | Add the 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] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > To view this discussion on the web visit > <https://groups.google.com/d/msgid/ansible-project/d02cdddc-222f-4d71-9a0c-ab6baf7750c0%40googlegroups.com?utm_medium=email&utm_source=footer> > https://groups.google.com/d/msgid/ansible-project/d02cdddc-222f-4d71-9a0c-ab6baf7750c0%40googlegroups.com > . > 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/0d949cba-c6f4-47c7-b17f-8e797332b7ef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
