# role dependencies question

**URL:** <https://forum.ansible.com/t/role-dependencies-question/20107>\
**Category:** Ansible Project\
**Created:** [January 1, 2016, 5:49pm UTC](https://forum.ansible.com/t/role-dependencies-question/20107 "2016-01-01T17:49:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user46](https://avatars.discourse-cdn.com/v4/letter/u/c37758/32.png) [@user46](https://forum.ansible.com/u/user46)\
**Post date:** [January 1, 2016, 5:49pm UTC](https://forum.ansible.com/t/role-dependencies-question/20107/1 "2016-01-01T17:49:31Z")

</div>

hi,

i have role1 which depend on role2. and i want role2 to know the path of role1 without being hardcoded, how can i achieve this?

#role1/meta/main.yml  
dependencies:

- { role: role2, role\_dir: “{{role\_path}}” } → it doesn’t work, role\_dir is always the path of role2

thanks

---

<div class="post-metadata">

**Author:** ![chrismeyersfsu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chrismeyersfsu/32/1016_2.png) [@chrismeyersfsu](https://forum.ansible.com/u/chrismeyersfsu)\
**Post date:** [January 1, 2016, 6:52pm UTC](https://forum.ansible.com/t/role-dependencies-question/20107/2 "2016-01-01T18:52:55Z")

</div>

Use the role\_path variable to get most of the path. Then go back a dir and into role1.

- { role: role2, role\_dir: “{{ role\_path }}/…/role1” }

---

<div class="post-metadata">

**Author:** ![user46](https://avatars.discourse-cdn.com/v4/letter/u/c37758/32.png) [@user46](https://forum.ansible.com/u/user46)\
**Post date:** [January 2, 2016, 3:22pm UTC](https://forum.ansible.com/t/role-dependencies-question/20107/3 "2016-01-02T15:22:24Z")

</div>

Thanks, this could be a solution.
