# Any one got a good callback plugin tutorial/documentation

**URL:** <https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184>\
**Category:** Ansible Project\
**Created:** [October 6, 2022, 3:06pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184 "2022-10-06T15:06:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Coussens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stefan_coussens/32/8432_2.png) [@Stefan\_Coussens](https://forum.ansible.com/u/Stefan_Coussens)\
**Post date:** [October 6, 2022, 3:06pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/1 "2022-10-06T15:06:51Z")

</div>

Hi,

I am trying to write a callback plugin. It is working quite well when all tasks succeed. However when a playbook has a failed task I get:

**v2\_runner\_on\_failed() got an unexpected keyword argument**

**‘ignore\_errors’**

Code:

def v2\_runner\_on\_failed(self, result):  
pass

I see a lot of plugins that have an extra argument , ignore\_errors=False. But I can’t figure out what this setting does. I think I need to have:

def v2\_runner\_on\_failed(self, taskResult, ignore\_errors=True):

I just want my playbook to continue and not stop because of the callback plugin.

Can anyone point me into the right direction

kind regards,

Stefan

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 6, 2022, 3:10pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/2 "2022-10-06T15:10:19Z")

</div>

In implementing callback methods, they have to adhere to the callback interface.

The `v2_runner_on_failed` method is defined as:

[https://github.com/ansible/ansible/blob/4260b71cc77b7a44e061668d0d408d847f550156/lib/ansible/plugins/callback/ **init**.py#L506](https://github.com/ansible/ansible/blob/4260b71cc77b7a44e061668d0d408d847f550156/lib/ansible/plugins/callback/ __init__.py#L506)

As such, your plugin has to accept the same arguments as defined there.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 6, 2022, 3:13pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/3 "2022-10-06T15:13:18Z")

</div>

ignore\_errors is used to 'report the error, but that we also ignored  
the consequences of it' meaning that the task failed for the host but  
that the host was not removed from 'active hosts'. the default  
callback adds an 'ignoring error' message in this case.

---

<div class="post-metadata">

**Author:** ![Stefan\_Coussens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stefan_coussens/32/8432_2.png) [@Stefan\_Coussens](https://forum.ansible.com/u/Stefan_Coussens)\
**Post date:** [October 6, 2022, 3:26pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/4 "2022-10-06T15:26:20Z")

</div>

Is it correct that I can just leave out the entire v2\_runner\_on\_failed since the interface does the same thing (pass) and I do not need to override the method?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 6, 2022, 3:28pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/5 "2022-10-06T15:28:26Z")

</div>

You only need to implement the methods you are concerned with. Omission of a method is allowed.

---

<div class="post-metadata">

**Author:** ![Stefan\_Coussens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stefan_coussens/32/8432_2.png) [@Stefan\_Coussens](https://forum.ansible.com/u/Stefan_Coussens)\
**Post date:** [October 6, 2022, 3:35pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/6 "2022-10-06T15:35:53Z")

</div>

Does this mean that when I would set ignore\_errors=True that the next task of that host would be executed?

---

<div class="post-metadata">

**Author:** ![Stefan\_Coussens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stefan_coussens/32/8432_2.png) [@Stefan\_Coussens](https://forum.ansible.com/u/Stefan_Coussens)\
**Post date:** [October 6, 2022, 3:36pm UTC](https://forum.ansible.com/t/any-one-got-a-good-callback-plugin-tutorial-documentation/37184/7 "2022-10-06T15:36:14Z")

</div>

Thank you very much
