# Dynamic Includes + Tags = Failures

**URL:** <https://forum.ansible.com/t/dynamic-includes-tags-failures/22873>\
**Category:** Ansible Developer\
**Created:** [October 25, 2016, 1:19am UTC](https://forum.ansible.com/t/dynamic-includes-tags-failures/22873 "2016-10-25T01:19:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve5](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@steve5](https://forum.ansible.com/u/steve5)\
**Post date:** [October 25, 2016, 1:19am UTC](https://forum.ansible.com/t/dynamic-includes-tags-failures/22873/1 "2016-10-25T01:19:43Z")

</div>

I am on the latest of the devel branch, and I am not entirely sure if this is expected behavior or not. I have a couple issues, where in my main.yml in my playbook, I have roles that are tagged at the top level and then I have common roles that are shared.

`

- { role: “java-base”, tags: “java” }
- { role: “nginx-base”, tags: “nginx” }

`

Java and Nginx share a common role that has an include task that utilizes with\_items. Now when I run the tag java, I would expect that it would just run Java, but with the advent of dynamic includes it also runs all of the includes from the nginx task as well. I believe this is how it was in 2.1. However, now there is a failure in 2.2 that says it failed b/c the with\_items object that I am using is not defined (because everything else was skipped so the object in the with\_items is undefined). When I try to use a when block in the include it still gives me that failure.

I am curious if there is a workaround to this or maybe I am just doing something incorrectly (which is certainly a possiblity). I can hide the output with a callback plugin, but when I utilize the junit plugin it notes the includes as failures.

Thanks!

Steven
