# "role" variable

**URL:** <https://forum.ansible.com/t/role-variable/20442>\
**Category:** Ansible Project\
**Created:** [February 3, 2016, 5:42pm UTC](https://forum.ansible.com/t/role-variable/20442 "2016-02-03T17:42:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Warren\_Seine](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@Warren\_Seine](https://forum.ansible.com/u/Warren_Seine)\
**Post date:** [February 3, 2016, 5:42pm UTC](https://forum.ansible.com/t/role-variable/20442/1 "2016-02-03T17:42:35Z")

</div>

Hi,

In Ansible 1.9.4, I was able to use role as a variable to get the current role name. In Ansible 2, the variable does not seem to be defined. Any replacement?

role\_path is defined so I could use {{ role\_path | basename }}, but that’s less convenient.

---

<div class="post-metadata">

**Author:** ![Warren\_Seine](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@Warren\_Seine](https://forum.ansible.com/u/Warren_Seine)\
**Post date:** [February 4, 2016, 10:34am UTC](https://forum.ansible.com/t/role-variable/20442/2 "2016-02-04T10:34:52Z")

</div>

Ok, that’s role\_name now.
