Hi
I'm often finding myself having to run a specific role from some of
our playbooks.
Currently I'm using the '--tags' option for ansible-playbook, and we
tag the role in our playbook like this:
roles:
- somerole
- another_role
- { role: myrole, tags: myrole }
- yetanotherrole
But now we'd have to add the tag to each invocation in every playbook,
which is not ideal.
For our inhouse developed roles we're "abusing" main.yml to wrap
another task file so that we can tag all the tasks in the entire role:
myrole/tasks/main.yml:
- include: myrole.yml
tags: myrole
This works better, we can just use the role as is without defining
tags in the playbooks, and still use --limit when running
ansible-playbook. So far so good.
But the wrapper task file still feel a bit clumsy.
Is there any way to define tags in a role itself?
PS I realise we can also wrap all tasks in a 'block' but that's not
ideal either....
I think I'm looking for something like a tags/ directory inside a role
where I can define tags that apply to all tasks in a role..?
Thanks!
Dick