# Tags are confusing

**URL:** <https://forum.ansible.com/t/tags-are-confusing/35177>\
**Category:** Ansible Developer\
**Created:** [May 17, 2021, 1:55pm UTC](https://forum.ansible.com/t/tags-are-confusing/35177 "2021-05-17T13:55:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Faine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mark_faine/32/7291_2.png) [@Mark\_Faine](https://forum.ansible.com/u/Mark_Faine)\
**Post date:** [May 17, 2021, 1:55pm UTC](https://forum.ansible.com/t/tags-are-confusing/35177/1 "2021-05-17T13:55:13Z")

</div>

My goal is to use a single tag to run specific roles independently but have dependent roles run as well with only the single tag.

My roles are in a playbook:

playbook.yml  
roles:

role: roleA  
tags: roleA ← for lack of a better name  
role: roleB  
tags: roleB  
…

roles/roleA/meta/main.yml  
…  
dependencies:

- { role: roleA, roleB }

What I want to do is run ansible-playbook … --tags roleA and have roleB run as a dependency every time before roleA runs.

How can I do this?

Thanks,  
-Mark

---

<div class="post-metadata">

**Author:** ![Mark\_Faine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mark_faine/32/7291_2.png) [@Mark\_Faine](https://forum.ansible.com/u/Mark_Faine)\
**Post date:** [May 17, 2021, 2:14pm UTC](https://forum.ansible.com/t/tags-are-confusing/35177/2 "2021-05-17T14:14:13Z")

</div>

Looks like I can’t edit posts here for some reason.

**Correction:**

dependencies:

- { role: roleA, tags: roleA, roleB }

or at least that’s the way I want it to work.

The only purpose for this is to ensure that dependent roles for any of the tags I run also run. The only other option I can see is to add every single dependency as a tag to my dependent roles. Like this:

playbook.yml:  
roles:  
role: roleA  
tags: roleA ← for lack of a better name  
role: roleB  
tags:

- roleA
- roleC
- roleD  
… potentially very long list of tags

So I can then run any of the roles and know that roleB will always run. This however is very unwieldy and seems very unintuitive. There must be a better way.
