# Variables precedence in dependencies

**URL:** <https://forum.ansible.com/t/variables-precedence-in-dependencies/22526>\
**Category:** Ansible Project\
**Created:** [September 12, 2016, 9:37am UTC](https://forum.ansible.com/t/variables-precedence-in-dependencies/22526 "2016-09-12T09:37:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Federico\_Alaimo](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Federico\_Alaimo](https://forum.ansible.com/u/Federico_Alaimo)\
**Post date:** [September 12, 2016, 9:37am UTC](https://forum.ansible.com/t/variables-precedence-in-dependencies/22526/1 "2016-09-12T09:37:38Z")

</div>

Hello, I have a doubt regarding variables precedence:  
I sometimes have the case where role B depends on role A with role A needing a specific variable value.  
So in the dependencies file for role B I have something like:

dependencies:

- { role: role-A, role\_a\_var1: value1 }

But I’m not sure where this var declaration stands in the precedence list for ansible 2.0+. I’d like this to be stronger than site variables for instance, but less strong than inventory (group and host) variables.  
By the way for site variables I mean variables defined somewhere and included at some point in the playbook calling the role, with an include\_vars (so playbook level, actually?)

Thanks!

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 14, 2016, 1:04pm UTC](https://forum.ansible.com/t/variables-precedence-in-dependencies/22526/2 "2016-09-14T13:04:52Z")

</div>

Have you looked at this site, maybe that answer you question  
[https://docs.ansible.com/ansible/playbooks\_variables.html#variable-precedence-where-should-i-put-a-variable](https://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable)
