# include\_vars overrides subsequent role's vars/main.yml

**URL:** <https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414>\
**Category:** Ansible Project\
**Created:** [October 2, 2015, 10:06am UTC](https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414 "2015-10-02T10:06:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![t\_goto](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@t\_goto](https://forum.ansible.com/u/t_goto)\
**Post date:** [October 2, 2015, 10:06am UTC](https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414/1 "2015-10-02T10:06:39Z")

</div>

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  
`

---

<div class="post-metadata">

**Author:** ![Dan\_Stillman](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@Dan\_Stillman](https://forum.ansible.com/u/Dan_Stillman)\
**Post date:** [October 2, 2015, 7:07pm UTC](https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414/2 "2015-10-02T19:07:57Z")

</div>

I think that's the issue I reported here:

[https://github.com/ansible/ansible/issues/11996](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](https://groups.google.com/d/msg/ansible-project/4OIuDxRSv0M/RgW8HkuIKQAJ)

---

<div class="post-metadata">

**Author:** ![t\_goto](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@t\_goto](https://forum.ansible.com/u/t_goto)\
**Post date:** [October 3, 2015, 2:49pm UTC](https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414/3 "2015-10-03T14:49:02Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![Dan\_Stillman](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@Dan\_Stillman](https://forum.ansible.com/u/Dan_Stillman)\
**Post date:** [October 3, 2015, 6:03pm UTC](https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414/4 "2015-10-03T18:03:19Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![t\_goto](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@t\_goto](https://forum.ansible.com/u/t_goto)\
**Post date:** [October 5, 2015, 1:34am UTC](https://forum.ansible.com/t/include-vars-overrides-subsequent-roles-vars-main-yml/19414/5 "2015-10-05T01:34:24Z")

</div>

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

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