# variables overriding in dependent role in version 1.9.x

**URL:** <https://forum.ansible.com/t/variables-overriding-in-dependent-role-in-version-1-9-x/20351>\
**Category:** Ansible Project\
**Created:** [January 26, 2016, 11:06am UTC](https://forum.ansible.com/t/variables-overriding-in-dependent-role-in-version-1-9-x/20351 "2016-01-26T11:06:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hleb\_Valoshka](https://avatars.discourse-cdn.com/v4/letter/h/2acd7d/32.png) [@Hleb\_Valoshka](https://forum.ansible.com/u/Hleb_Valoshka)\
**Post date:** [January 26, 2016, 11:06am UTC](https://forum.ansible.com/t/variables-overriding-in-dependent-role-in-version-1-9-x/20351/1 "2016-01-26T11:06:38Z")

</div>

Hi all.

I have role\_a and role\_b which depends on role\_a.

role\_a defines variable var\_foo (in vars/main.yml), role\_b wants to redefine it (in its own vars/main.yml). With 1.7.2 this works, but with 1.9.[24] - not.

I’ve tried to pass required variable through meta (- {role: role\_a, var\_foo: “{{ var\_foo }}”}) but this doesn’t work as well.

So whether I’m doing it wrong or 1.9 is buggy?

---

<div class="post-metadata">

**Author:** ![Javier\_Palacios](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Javier\_Palacios](https://forum.ansible.com/u/Javier_Palacios)\
**Post date:** [January 26, 2016, 12:22pm UTC](https://forum.ansible.com/t/variables-overriding-in-dependent-role-in-version-1-9-x/20351/2 "2016-01-26T12:22:33Z")

</div>

Not used 1.7, only 1.9. And my experience is that only variables defined on defaults/main.yml on dependant role can be overridden. I usually use group\_vars to override them, but in a few corner cases the only way I found to achieve what you pretend to do is to override them at the playbook level, and only when defined whithin the role definition (see below) and not in the playbook vars block (my tree is far more complex that only parent and children).  
I did just consider it an annoyance, but as you state that it worked on 1.7 (and is what I expected at the beginning), it could be probably a bug.
