I defined the callback as follows:
import sys
import pprint
from ansible.plugins.callback import CallbackBase
class JSONPrettyPrintCallback(CallbackBase):
printer = pprint.PrettyPrinter(indent=4, stream=sys.stdout)
def log(self, host, category, data):
self.printer.pprint({'host': host, 'category': category, 'data': data})
In my Ansible config, I defined a path:
[defaults]
callback_plugins = callback_plugins/
However, when I run my module, I still see the default Ansible output:
10.0.0.1 | SUCCESS => {
...
}
I run it as follows:
ansible all -u myuser -m script -a 'path/to/script.py'
Do I need to do something to properly format my output?
source
share