This is one play.
Add separate plays for localhost etc.

On Mon, 5 Oct 2020 at 17:44, [email protected] <[email protected]>
wrote:

> Hi guys,
>
> I have 3 roles:
>  - role A: which needs to be executed on localhost
>  - role B: which needs to run on a remote host
>  - role C: which is a rescue role that cleans up some things which role A
> did on localhost (this one should always run, especially if some task
> failed in one of the other roles)
>
> How could I achieve this?
>
> The closest I've been was something like:
>
> ```
> - hosts: all
>   tasks:
>     - block:
>       - include_role:
>         name: role A
>      - include_role:
>         name: role B
>      always:
>        - include_role:
>         name: role C
> ```
>
> but this of course has no posibilty of changing the hosts against which it
> is run ('localhost' is not 'all' being the problem)
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9b9d54eb-14a4-4a25-bb7c-2621c6aed25bn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/9b9d54eb-14a4-4a25-bb7c-2621c6aed25bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNerer-p68dyV0_%2BpF20PWaiKa%2BgZRoLtRMvFpT5iNiaQ%40mail.gmail.com.

Reply via email to