# Role tag?

**URL:** <https://forum.ansible.com/t/role-tag/24943>\
**Category:** Ansible Project\
**Created:** [July 10, 2017, 5:28pm UTC](https://forum.ansible.com/t/role-tag/24943 "2017-07-10T17:28:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 10, 2017, 5:28pm UTC](https://forum.ansible.com/t/role-tag/24943/1 "2017-07-10T17:28:18Z")

</div>

Hi

I'm often finding myself having to run a specific role from some of  
our playbooks.  
Currently I'm using the '--tags' option for ansible-playbook, and we  
tag the role in our playbook like this:

roles:  
&nbsp;&nbsp;- somerole  
&nbsp;&nbsp;- another\_role  
&nbsp;&nbsp;- { role: myrole, tags: myrole }  
&nbsp;&nbsp;- yetanotherrole

But now we'd have to add the tag to each invocation in every playbook,  
which is not ideal.

For our inhouse developed roles we're "abusing" main.yml to wrap  
another task file so that we can tag all the tasks in the entire role:

myrole/tasks/main.yml:

- include: myrole.yml  
&nbsp;&nbsp;tags: myrole

This works better, we can just use the role as is without defining  
tags in the playbooks, and still use --limit when running  
ansible-playbook. So far so good.

But the wrapper task file still feel a bit clumsy.  
Is there any way to define tags in a role itself?

PS I realise we can also wrap all tasks in a 'block' but that's not  
ideal either....

I think I'm looking for something like a tags/ directory inside a role  
where I can define tags that apply to all tasks in a role..?

Thanks!

Dick
