I’m new to Ansible and I’m trying to write a callback for storing results of my playbooks in a database.
My problem is that I don’t manage to make my callbacks ran by Ansible.
Here is a part of my /etc/ansible/ansible.cfg file:
As you can see, according to PR #8911, I set the load_callback_plugins variable to True but that didn’t fix my issue.
In /usr/share/ansible_plugins/callback_plugins I have two .py callback files (mail.py – the famous one – and a custom callback) but none of them seems to be ran.
I’m using the built-in /etc/ansible/ansible.cfg file provided by the Debian Package.
I’m certain that it is picked up because I turned the logging on and it worked.
Have the callback files to be executable or just readable (as it is by now)?
Neither of my plugins are set to be executable, but I am running from a git checkout at the moment.
The mail plugin only seems to be interested in failure events so perhaps it is not getting fired?
I’d try creating the simplest possible plugin just to see if it is getting triggered, something like the following (not tested!):
`
testplugin.py
import os
class CallbackModule(object):
“”"
This trivial callback module does nothing useful, just prints a message when it is initialized.
“”"
def init(self):
print “custom plugin is active.”
And that was the good test to do: “custom plugin is active.” is well printed when I run my ansible-playbook command.
So my callbacks are executed, my issue is somewhere else. I will re-read the mail.py callback to understand what could be my issue.
Thank you very much for your guidelines