On 12.10.2017 07:41, Behrang Saeedzadeh wrote:
I would just give tasks that have both foo and bar as tags a third tag
that will allow those tasks to be run

Unfortunately this won't work for me. I have multiple roles imported in my
playbook:

    - { role: a, tags: ["a"] }
    - { role: b, tags: ["b"] }
    - { role: b, tags: ["c"] }
    - { role: c, tags: ["d"] }

So all tasks within role a inherit the tag a, the tasks within role b
inherit the tag b, and so forth.

Inside these roles, some tasks are tagged with, say "x". I want to execute
the "x" task in role "b".

You can achieve this by using when on the role to check a variable that you provide with extra_vars on the command line and keep the tags in the roles.

--
Kai Stian Olstad

--
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/bdf934e6e82f8b3ac3a90ac781ca657e%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to