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 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/d02cdddc-222f-4d71-9a0c-ab6baf7750c0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.