# magic variable for roles?

**URL:** <https://forum.ansible.com/t/magic-variable-for-roles/12763>\
**Category:** Ansible Project\
**Created:** [May 2, 2013, 11:02pm UTC](https://forum.ansible.com/t/magic-variable-for-roles/12763 "2013-05-02T23:02:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yves\_Dorfsman](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@Yves\_Dorfsman](https://forum.ansible.com/u/Yves_Dorfsman)\
**Post date:** [May 2, 2013, 11:02pm UTC](https://forum.ansible.com/t/magic-variable-for-roles/12763/1 "2013-05-02T23:02:10Z")

</div>

Is there a magic variable to know which role a task is part of?

I'd like to do something like this inside a role/\*/tasks/main.yml:

- name: ${role} create conf directory  
&nbsp;&nbsp;&nbsp;command: mkdir /opt/${role}/conf

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 3, 2013, 12:37am UTC](https://forum.ansible.com/t/magic-variable-for-roles/12763/2 "2013-05-03T00:37:55Z")

</div>

No.
