# Dynamic Includes: assigning dynamic tags to included files

**URL:** <https://forum.ansible.com/t/dynamic-includes-assigning-dynamic-tags-to-included-files/22725>\
**Category:** Ansible Project\
**Created:** [October 5, 2016, 1:24pm UTC](https://forum.ansible.com/t/dynamic-includes-assigning-dynamic-tags-to-included-files/22725 "2016-10-05T13:24:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rszalski](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@rszalski](https://forum.ansible.com/u/rszalski)\
**Post date:** [October 5, 2016, 1:24pm UTC](https://forum.ansible.com/t/dynamic-includes-assigning-dynamic-tags-to-included-files/22725/1 "2016-10-05T13:24:54Z")

</div>

Hi,

I’m using dynamic includes and wonder if there is a way to dynamically tag them.

The following usage of ‘tags’:

`

- include: ‘{{ item }}.yml’  
tags: ‘{{ item }}’  
with\_items:
- a
- b
- c  
`

results in an error:

`ERROR! 'item' is undefined`

I would expect the tasks in each included file to be tagged respectively ‘a’, ‘b’ and ‘c’.

without tags: ‘{{ item }}’ this works as expected.

Maybe there is another way to tag all tasks inside an included file without specifying the tag for each task?

Thanks,  
rszalski

---

<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:** [March 3, 2017, 10:04pm UTC](https://forum.ansible.com/t/dynamic-includes-assigning-dynamic-tags-to-included-files/22725/2 "2017-03-03T22:04:44Z")

</div>

tags are not dynamic, they are evaluated at compile time so no  
variables are available.
