Current failure count?

134 views
Skip to first unread message

Mike Titus

unread,
May 19, 2014, 2:45:39 PM5/19/14
to ansible...@googlegroups.com
Is there any way, during the execution of a playbook, to access the current failure count?  The final failure count is displayed in the PLAY RECAP section of the log output:

xxx.xx.xx.xxx    : ok=37   changed=1    unreachable=0    failed=3

Before the playbook completes, I want to check the failure count and send an alert if n > 1.

Thanks,

Mike

Matt Martz

unread,
May 19, 2014, 3:16:48 PM5/19/14
to ansible...@googlegroups.com
You would need to utilize a callback plugin.

Your CallbackModule class could implement a counter attribute, and runner_on_failed could increment and check the count.

If it exceeds a threshold, fire off some form of message.

--
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/b13c2ee0-117c-4695-a887-fc4d2c9456eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
ma...@sivel.net
http://sivel.net/

Michael DeHaan

unread,
May 21, 2014, 5:50:53 PM5/21/14
to ansible...@googlegroups.com
Currently yes.  I'm not opposed to the callback system being modified to keep these kind of counts, however, though I believe currently callback plugins do live in fork memory, thus it might not be possible.

Would have to dive in deeper.

Callback plugin is a possible answer.


Mike Titus

unread,
May 21, 2014, 6:48:16 PM5/21/14
to ansible...@googlegroups.com
Actually, I was just hoping for an $ansible_something variable that I could use in a module like  sns / pagerduty / etc.

Mike


On Wednesday, May 21, 2014 2:50:53 PM UTC-7, Michael DeHaan wrote:
Currently yes.  I'm not opposed to the callback system being modified to keep these kind of counts, however, though I believe currently callback plugins do live in fork memory, thus it might not be possible.

Would have to dive in deeper.

Callback plugin is a possible answer.
On Mon, May 19, 2014 at 3:16 PM, Matt Martz <ma...@sivel.net> wrote:
You would need to utilize a callback plugin.

Your CallbackModule class could implement a counter attribute, and runner_on_failed could increment and check the count.

If it exceeds a threshold, fire off some form of message.



On Monday, May 19, 2014, Mike Titus <mi...@ava.ai> wrote:
Is there any way, during the execution of a playbook, to access the current failure count?  The final failure count is displayed in the PLAY RECAP section of the log output:

xxx.xx.xx.xxx    : ok=37   changed=1    unreachable=0    failed=3

Before the playbook completes, I want to check the failure count and send an alert if n > 1.

Thanks,

Mike

--
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-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Michael DeHaan

unread,
May 23, 2014, 8:12:15 AM5/23/14
to ansible...@googlegroups.com
See my previous response, first sentence.


Reply all
Reply to author
Forward
0 new messages