Hello @all,
i have an strage behavior with role dependencies and tags.
I have an playbook like this:
`
Hello @all,
i have an strage behavior with role dependencies and tags.
I have an playbook like this:
`
For starters, ansible --version output?
This is happening because you have narrowed the scope of your tags, and the dependent role is only inheriting the “monitoring” tag from its parent role. If you still need to have your deps run when other tags are specified, you can add them to the list of tags on the dependency:
The same will go for your other tags, which you can add to the list.
I’m not sure that’s intuitive.
By tagging all things with “monitoring”, everything should get a “monitoring”.
additionally, the included tasks add a “monitoring:crc”
I would expect tags should be additive, and “narrowing the scope of your tags” is not a thing that should be a language concept IMHO.
The version is ansible 1.7.2 (1.7.2+dfsg-2~bpo70+1 - installed from distri repo debian wheezy)
Yes, i narrowed the scope of my tag because i want to run only an subset of tasks of the role.
But as this are tasks in the monitoring role, i was expecting the dependency is triggered an the monitoring-basic role is run anyway.
I can tag the dependenies also with an whole bunch of tags, but in that case i have to think about it an on every addition in the monitoring role with an other tag
i also have to adjust the dependency tags.
Hi Daniel,
Michael and I ran through this and we agree this is operating as expected, since tags applied directly to tasks (like your include statements in tasks/main.yml) are not applied to dependent roles (nor would we expect them to be). So, as I suggested in my reply, you just need to add whatever additional tags may be required to your dependency definitions and you should be good to go.
Let us know if you have any further questions regarding this.
Thanks!
“since tags applied directly to tasks (like your include statements in tasks/main.yml) are not applied to dependent roles (nor would we expect them to be)”
I may have been confused with the discussion.
I do expect tags like this:
That dependent roles of “doit” run when you say “doit”.
Ok, communication issue on my end.
“doit” does get applied to everything, and we are good there (no bugs!)
It isn’t true that adding a tag to the “include” statement you have manually inside the role would affect the deps. That would only affect the included tasks in that file.
Sorry for confusion!
So i think i have to “redesign” my monitoring role to add the tags to the dependency (in meta.yml) or to split the role in multiple roles.
Thanks for your help.