Callback calling a playbook or role

97 views
Skip to first unread message

ralo...@gmail.com

unread,
Mar 23, 2014, 7:27:57 PM3/23/14
to ansible...@googlegroups.com
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 :)

Thanks.
raphael.

Michael DeHaan

unread,
Mar 23, 2014, 7:34:30 PM3/23/14
to ansible...@googlegroups.com
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


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/26bf876e-5b88-47d8-9fe1-1e11ad399c32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ralo...@gmail.com

unread,
Mar 23, 2014, 7:40:15 PM3/23/14
to ansible...@googlegroups.com
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)

Michael DeHaan

unread,
Mar 23, 2014, 7:41:39 PM3/23/14
to ansible...@googlegroups.com
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 :)


Reply all
Reply to author
Forward
0 new messages