I have defined a callback like so:
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import sys
import pprint
from ansible.plugins.callback import CallbackB
If you want to replace Ansible standard output, you should set stdout_callback parameter to your callback.
Update: stdout_callback parameter will affect only ansible-playbook CLI output, as correctly noted in the comments.
I've investigated the code a bit, ansible CLI supports only minimal and oneline (if -o option is set) stdout callbacks.
The easiest way to change the output behavior is to place ./callback_plugins/minimal.py in your playbook folder and modify it to your needs.
Or you can patch adhoc.py to be able to accept other stdout plugins.
There was a bug reported https://github.com/ansible/ansible/issues/16194 and Ansible CLI was just fixed in https://github.com/ansible/ansible/pull/26098 to respect custom stdout_callback.
To have custom callbacks working you need to specify both stdout_callback (ANSIBLE_STDOUT_CALLBACK env) and bin_ansible_callbacks = Yes (ANSIBLE_LOAD_CALLBACK_PLUGINS env).
The change should be backported to both Ansible 2.2 and 2.3