# Including tasks from another role

**URL:** <https://forum.ansible.com/t/including-tasks-from-another-role/15989>\
**Category:** Ansible Project\
**Created:** [August 20, 2014, 7:21am UTC](https://forum.ansible.com/t/including-tasks-from-another-role/15989 "2014-08-20T07:21:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akos\_Vandra](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Akos\_Vandra](https://forum.ansible.com/u/Akos_Vandra)\
**Post date:** [August 20, 2014, 7:21am UTC](https://forum.ansible.com/t/including-tasks-from-another-role/15989/1 "2014-08-20T07:21:23Z")

</div>

Hello!

Is there any way to include tasks from another role other than:

- include: ../../common/tasks/rake\_db\_migrate.yml project\_dir={{deployed\_to}}

I would like to see that either

- include: common/tasks/rake\_db\_migrate.yml project\_dir={{deployed\_to}}  
or  
- include: /common/tasks/rake\_db\_migrate.yml project\_dir={{deployed\_to}}  
or  
- include: /roles/common/tasks/rake\_db\_migrate.yml project\_dir={{deployed\_to}}

works

Regards,  
&nbsp;&nbsp;Akos Vandra

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 20, 2014, 1:06pm UTC](https://forum.ansible.com/t/including-tasks-from-another-role/15989/2 "2014-08-20T13:06:34Z")

</div>

You definitely don’t want to specify a path off of “/” (root).

It sounds like you are asking to not have to use relative paths.

You can do this.

- include: {{ playbook\_dir }}/roles/foo/tasks/bar.yml

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 20, 2014, 1:06pm UTC](https://forum.ansible.com/t/including-tasks-from-another-role/15989/3 "2014-08-20T13:06:48Z")

</div>

Forgot my quotes 🙂

- include: “{{ playbook\_dir }}/roles/foo/tasks/bar.yml”
