# \--tags tag1 AND tag2, possible?

**URL:** <https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [June 4, 2015, 7:55pm UTC](https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408 "2015-06-04T19:55:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [June 4, 2015, 7:55pm UTC](https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408/1 "2015-06-04T19:55:51Z")

</div>

Hi,

I have a role which supports multiple platforms (Debian, RHEL,  
FreeBSD, OpenBSD). I use 'when: ansible\_pkg\_mgr == ...' a lot to  
autodetect, but that results in a lot of skipping... so I thought I  
might use tags in addition, so users can choose to specifically select  
only their platform to speedup playbook runs.

I would have OS specific tags in mind (debian, freebsd, ...) and task  
oriented tags (install, configure, ...).

While playing with it, I noticed that '--tags debian,install' runs  
tasks that are tagged as 'debian' OR 'install' (which includes tasks  
tagged as freebsd,install -\> results in lot of skipping again), is  
there a way to say run only 'debian' \*AND\* 'install' tagged tasks?

thanks!  
nusenu

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 4, 2015, 8:01pm UTC](https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408/2 "2015-06-04T20:01:21Z")

</div>

not currently, a feature request we have is that tags get ‘host expressions’, so this would look like;

tag1:&tag2

but there is currently no code that does this

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [June 4, 2015, 8:27pm UTC](https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408/3 "2015-06-04T20:27:29Z")

</div>

Brian Coca:

> not currently, a feature request we have is that tags get 'host  
> expressions', so this would look like;
> 
> tag1:&tag2
> 
> but there is currently no code that does this

thanks for the prompt reply.

I tried to find that feature request, via:

[https://github.com/ansible/ansible/issues?utf8=✓&q=is%3Aopen+label%3Afeature\_idea+tags](https://github.com/ansible/ansible/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3Afeature_idea+tags)

but did not find it. Would you point me to it?

thanks

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 5, 2015, 3:03pm UTC](https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408/4 "2015-06-05T15:03:30Z")

</div>

I was not thinking of a specific ticket, but there should be many  
instances of this being requested via the maliing lists and IRC and  
even as comments in other tag related tickets.

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [June 5, 2015, 7:39pm UTC](https://forum.ansible.com/t/tags-tag1-and-tag2-possible/18408/5 "2015-06-05T19:39:20Z")

</div>

Brian Coca:

> I was not thinking of a specific ticket, but there should be many  
> instances of this being requested via the maliing lists and IRC  
> and even as comments in other tag related tickets.

ok sounds like one should create an issue for it:

[https://github.com/ansible/ansible/issues/11185](https://github.com/ansible/ansible/issues/11185)
