I am experiencing some strange behavior from what I understand to be applying tags to roles/dependencies. I wrote a facts plugin to gather information about a systems role, and it includes this in the playbook run. Each system runs a playbook on its own, only managing itself.
Thanks, Michael. One question about this bug/behavior, I want to verify. If tags are applied at the role level, is it supposed to run each role, regardless of the when statement?
roles:
{ role: appserver, tags: [‘initial’], when: “‘APPSERVERS’ in ansible_local.host_roles.roles” }
{ role: hadoop_jobtracker, tags: [‘initial’], when: “‘HADOOP_JOBTRACKER’ in ansible_local.host_roles.roles” }
In this case, both appserver and the hadoop_jobtracker roles are applied, disregarding my when statement. Do tags take precendence over other logic?
I am able to workaround this bug by adding an include statement in the tasks for each role, and everything works properly.
"Thanks, Michael. One question about this bug/behavior, I want to verify. If tags are applied at the role level, is it supposed to run each role, regardless of the when statement? "
tags and conditionals in ansible are very different things.
If you run all things tagged “X”, it would still evaluate the conditionals on all things tagged “X”. Hope this makes sense.
Curious the above typo did not produce an error, can you file a bug about that one?