Callback calling a playbook or role

Hi List.

We have a set of tasks in a role that we’d like to be run last on every single host, each time.
It seems like a job for a callback.

Before I dive into it, is it possible for a callback to run a role (the after playbook callback) or a whole playbook (the after run success callback).
All the examples show local action. Is that because of a limitation or just because an example never came up or did I just miss it ?

Bonus point for pointing me in the direction :slight_smile:

Thanks.
raphael.

Ansible callbacks that read events do not have the ability to insert other events to be run.

You can solve this in two ways, always include that role last in the list of roles for each group, or have your playbooks end in a play that applies that role to all hosts.

–Michael

Thanks Michael.
We chose the second option so far, I hoped there was a way to DRY it up.

For the record, you’re one of the most efficient OSS maintainer I ever saw. Kudos.
(and Ansible rocks)

Technically a playbook callback might be able to use low level methods inside Playbook code to run some extra tasks before things are done (MAYBE), but it’s not really a supported thing and those signatures are going to change under you.

So you’re stuck with wet and slippery, I’m afraid :slight_smile: