include_vars overrides subsequent role's vars/main.yml

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
`

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

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:

Thanks for info, Dan.
Glad to see that at least someone is already working on it :), and it probably will be fixed in ver2.

Well, unfortunately that’s not the case — my point was that, even though this was acknowledged as a bug in 1.9 that had been fixed in 2.0, the GitHub issue was left closed after I reported that it had regressed again in 2.0. And given that none of the simple test cases I’ve provided for this and other variable precedence bugs have been incorporated into the test suite, there’s no reason to think that, even if it is fixed, it will stay that way.

well, in that case I will have to stay vigilant :frowning:
Thank you.

2015年10月4日日曜日 3時03分35秒 UTC+9 Dan Stillman: