Callbacks for generic Ansible runs?

前端 未结 2 424
后悔当初
后悔当初 2020-12-20 04:40

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         


        
2条回答
  •  半阙折子戏
    2020-12-20 05:14

    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.

提交回复
热议问题