"Play recap" or current status programmatically available in task?

148 views
Skip to first unread message

Daniel Schroeder

unread,
Jul 24, 2014, 5:35:48 AM7/24/14
to ansible...@googlegroups.com
Hello,

I'd like to send a summary of the run (basically the play recap which is shown after playbook execution on the command line) to a hipchat room.

PLAY RECAP ********************************************************************
host1    
: ok=8    changed=0    unreachable=0    failed=0    
host2    
: ok=8    changed=0    unreachable=0    failed=0    
host3    
: ok=8    changed=0    unreachable=0    failed=0



Is there a way how I could programmatically access the current status?


Thanks,

Daniel

Michael DeHaan

unread,
Jul 24, 2014, 7:07:48 AM7/24/14
to ansible...@googlegroups.com
The answer to accessing events programmatically is a callback plugin, and Matt Martz from Rackspace contributed one exactly for hipchat.


See the docs about callback plugins, but basically you just need to have this stored at a filesystem location and configure ansible.cfg to include the callback plugin directory that it is in, and it will load everything in that dir.

You may wish to modify the output it creates.

This is a way better way to share things in chat than the individual notification modules for things like this, as callbacks have an opportunity to see *everything* and it's also going to be more efficient as they can limit the number of connections/disconnections involved in the chat server.




--
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/c6bdbeb1-8371-4643-9c05-84b8c26e3b40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Schroeder

unread,
Jul 25, 2014, 4:41:10 AM7/25/14
to ansible...@googlegroups.com
Thanks Michael,

I already worked with plugins but have totally overlooked the callback plugins. This rises followup question on my end but I will start a separate topic on that.

Thanks,
Daniel
Reply all
Reply to author
Forward
0 new messages