Looks like I can't edit posts here for some reason.  

*Correction:*

dependencies:
  -  { role: roleA, tags: roleA, roleB }

or at least that's the way I want it to work.

The only purpose for this is to ensure that dependent roles for any of the 
tags I run also run.   The only other option I can see is to add every 
single dependency as a tag to my dependent roles.  Like this:

playbook.yml:
roles:
  role:  roleA
  tags: roleA <- for lack of a better name
  role: roleB
  tags: 
    - roleA
    - roleC
    - roleD
    ... potentially very long list of tags

So I can then run any of the roles and know that roleB will always run.  
This however is very unwieldy and seems very unintuitive.  There must be a 
better way.

On Monday, May 17, 2021 at 8:55:13 AM UTC-5 Mark Faine wrote:

>
> My goal is to use a single tag to run specific roles independently but 
> have dependent roles run as well with only the single tag.
>
> My roles are in a playbook:
>
> playbook.yml
> roles:
>   role:  roleA
>   tags: roleA <- for lack of a better name
>   role: roleB
>   tags: roleB
>   ...
>
> roles/roleA/meta/main.yml
> ...
> dependencies:
>   -  { role: roleA, roleB }
>
> What I want to do is run ansible-playbook ... --tags roleA and have roleB 
> run as a dependency every time before roleA runs.
>
> How can I do this?
>
> Thanks,
> -Mark
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/9f36d331-bbe4-463d-9294-aed6e2469bcan%40googlegroups.com.

Reply via email to