# role variables

**URL:** <https://forum.ansible.com/t/role-variables/29482>\
**Category:** Ansible Project\
**Created:** [January 21, 2019, 2:45pm UTC](https://forum.ansible.com/t/role-variables/29482 "2019-01-21T14:45:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sreejith\_Sreejayan](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Sreejith\_Sreejayan](https://forum.ansible.com/u/Sreejith_Sreejayan)\
**Post date:** [January 21, 2019, 2:45pm UTC](https://forum.ansible.com/t/role-variables/29482/1 "2019-01-21T14:45:53Z")

</div>

Anybody knows passing solution vars\_files in dependencies role

i have variable files located in vars dir but i tried to pass vars\_files in this play but its not working any solution to solve this issues .

now passing var like this vars:  
aws\_efs\_paths:

- { path: “/iphare”, owner: “root”, group: “root”, mode: “0644”, region: “hello-1”, filesystem\_id: “hdk-hfksd-lf”} but i have vars file with different env in vars passing this to all playbook is difficult .

dependencies:

- role: nfs  
vars:  
aws\_efs\_paths:
- { path: “/iphare”, owner: “root”, group: “root”, mode: “0644”, region: “hello-1”, filesystem\_id: “hdk-hfksd-lf”}

---

<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:** [January 21, 2019, 3:11pm UTC](https://forum.ansible.com/t/role-variables/29482/2 "2019-01-21T15:11:59Z")

</div>

It's hard to overwrite vars variable in roles, check the precedence here  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_variables.html#variable-precedence-where-should-i-put-a-variable](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable)

Instead of using vars in the role use defaults, and you can overwrite them everywhere.

---

<div class="post-metadata">

**Author:** ![Sreejith\_Sreejayan](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Sreejith\_Sreejayan](https://forum.ansible.com/u/Sreejith_Sreejayan)\
**Post date:** [January 21, 2019, 3:57pm UTC](https://forum.ansible.com/t/role-variables/29482/3 "2019-01-21T15:57:01Z")

</div>

Thank you, Kai Stain Olstad i will check that
