# Should tags work on includes?

**URL:** <https://forum.ansible.com/t/should-tags-work-on-includes/17091>\
**Category:** Ansible Project\
**Created:** [December 17, 2014, 6:00pm UTC](https://forum.ansible.com/t/should-tags-work-on-includes/17091 "2014-12-17T18:00:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quentin\_Stafford-Fra](https://avatars.discourse-cdn.com/v4/letter/q/b2d939/32.png) [@Quentin\_Stafford-Fra](https://forum.ansible.com/u/Quentin_Stafford-Fra)\
**Post date:** [December 17, 2014, 6:00pm UTC](https://forum.ansible.com/t/should-tags-work-on-includes/17091/1 "2014-12-17T18:00:02Z")

</div>

Hello all…

In the docs [here](http://docs.ansible.com/playbooks_tags.html) it suggests that I should be able to add tags to an include statement like this:

> * * *
> 
> - include: site.yml tags=foo

This simple playbook works fine unless I try actually doing anything with tags, like this:

> ansible-playbook -i hosts foo.yml --tags foo

which gives me an error:

> ERROR: tag(s) not found in playbook: foo. possible values:

The documentation suggests this should work. Am I doing something foolish?

Many thanks!  
Quentin

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 17, 2014, 6:09pm UTC](https://forum.ansible.com/t/should-tags-work-on-includes/17091/2 "2014-12-17T18:09:14Z")

</div>

Hi,

This was asked recently.

Tags work on task includes, and roles.

They do not currently do anything on playbook level includes.

This is something we may consider after the current refactoring effort (1.9 timeframe) completes.

---

<div class="post-metadata">

**Author:** ![viper233](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/viper233/32/2060_2.png) [@viper233](https://forum.ansible.com/u/viper233)\
**Post date:** [December 17, 2014, 6:10pm UTC](https://forum.ansible.com/t/should-tags-work-on-includes/17091/3 "2014-12-17T18:10:36Z")

</div>

That’s a common logical error that I’ve come across too. Tags aren’t called, they are only applied in playbooks, someone might be able to word that better.

The only way to call a tag is when running ansible playbook.

I spoke to Michael after Ansible fest San Fran and he mentioned that other are having this issue too.

I’m not sure if this is being addressed, someone else might know off the top of their head?

Stephen

---

<div class="post-metadata">

**Author:** ![Quentin\_Stafford-Fra](https://avatars.discourse-cdn.com/v4/letter/q/b2d939/32.png) [@Quentin\_Stafford-Fra](https://forum.ansible.com/u/Quentin_Stafford-Fra)\
**Post date:** [December 17, 2014, 6:16pm UTC](https://forum.ansible.com/t/should-tags-work-on-includes/17091/4 "2014-12-17T18:16:59Z")

</div>

Thanks, all…

I can work around them for now. Apologies for not seeing the earlier message. I did try searching but didn’t find it. Ironic, on a Google site 🙂

Q

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 17, 2014, 6:52pm UTC](https://forum.ansible.com/t/should-tags-work-on-includes/17091/5 "2014-12-17T18:52:10Z")

</div>

“That’s a common logical error that I’ve come across too. Tags aren’t called, they are only applied in playbooks, someone might be able to word that better.”

Unless I didn’t follow, I don’t think that was the above misunderstanding, but it is true that the include directive “labels” things with tags. It’s just not true you can label tags when you do a playbook include.

(It is true that including doesn’t select things with certain tags, as well)

I agree – Google is rough at search for everything but [Google.com](http://Google.com) – Gmail also, grr 🙂
