Dynamic Includes + Tags = Failures

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