Also, if you want to assign a specific tag in the role itself (as opposed 
to assigning it in every playbook using this role) - you can do it with 
include. Just move all the tasks from role's main.yml to a separate file 
and put include with tag in main.yml instead, like this:

- include: role_tasks.yml tags=sometag



On Wednesday, May 7, 2014 3:47:43 PM UTC-7, Strahinja Kustudić wrote:
>
> You can add a tag to a whole role like this:
>
> - hosts: servers
>   roles:
>     - { role: 'common', tags: 'common' }
>     - { role: 'nginx', tags: 'nginx' }
>     - { role: 'php-fpm', tags: 'php-fpm' }
>
>
>
>
> On Wednesday, May 7, 2014 1:14:47 PM UTC+2, rod naph wrote:
>>
>> Hi
>>
>> I'm reasonably new to Ansible (about 6 months usage) and have just 
>> started looking into how I could best make use of the tagging 
>> functionality. At the moment I usually only add tags when I need to run 
>> something as a one-off, so create a throwaway tag called 'foo', run the 
>> playbook and then remove the tag.
>>
>> When I first looked into tags I was expecting to be able to do it by 
>> role, but as tagging is only by task it seems to me at the moment I'd have 
>> to add lots of tags (as I have lots of tasks) - and was worried about this 
>> becoming a complete mess.
>>
>> Is anyone able to share/link any tips or tricks for how they use tags, or 
>> strategies for how they can best be managed and maintained.
>>
>> Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/57c3d621-f7e4-42a6-a7f7-339801d590d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to