leucos' answer is actually incorrect.
- include: ruby2.yml tags=ruby2
The above will tag every task in ruby2.yml
with the ruby2
tag, just as OP already mentioned.
This is clearly and explicitly documented here.
Question
In my roles/common/main.yml
I have - include ruby2.yml
. That file has 3-4 tasks and each one has tags: ruby2
. Works fine, but feels repetitive. The documentation says that when doing the include I could write it like this: - include: ruby2.yml tags=ruby2
But that puts the responsibility outside of the file itself which bugs me for some reason.
Is there a way, within ruby2.yml
to say "all of these tasks should have the 'ruby2' tag?"
La solution
leucos' answer is actually incorrect.
- include: ruby2.yml tags=ruby2
The above will tag every task in ruby2.yml
with the ruby2
tag, just as OP already mentioned.
This is clearly and explicitly documented here.
Autres conseils
AFAIK, there is no way to do that, and this is infortunate !
Note that
- include: ruby2.yml tags=ruby2
means "from ruby2.yml import tasks that have the 'ruby2' tag". It does not apply a tag to all actions.