-
-
Save rkrzr/f5387167fa7b4869e2dca8b713879562 to your computer and use it in GitHub Desktop.
Thanks.
Thanks!
Great, thx for sharing
Really useful, thanks a lot :-)
cooool, thanks !
I can't find any documentation on how to get the filenames in the respective role directory and creating tags to only run those filenames.
This is what "tasks_from" does when you include a role so it must be possible
Thx, works fine in Ansible 2.10
Thank you. This is very useful.
[DEPRECATION WARNING]: [defaults]callback_whitelist option, normalizing names
to new standard, use callbacks_enabled instead. This feature will be removed
from ansible-core in version 2.15. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.
I would advise to change:
callback_whitelist = auto_tags
to callbacks_enabled = auto_tags
Thanks very much for this.
Here is an adapted version that tags dependencies too:
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
def v2_playbook_on_start(self, playbook):
for play in playbook.get_plays():
self.tag_roles(play.get_roles())
def tag_roles(self, roles):
for role in roles:
self.tag_role(role)
self.tag_roles(role.get_direct_dependencies())
def tag_role(self, role):
role_name = role._role_name
if role_name not in role.tags:
role.tags += [role_name]
This is great, thanks! My old approach broke in Ansible 2.5, but this restores it.