add initial callback plugin poc draft; add simple debug.yml play to test easier
This commit is contained in:
139
callback_plugins/webhook_callback.py
Normal file
139
callback_plugins/webhook_callback.py
Normal file
@ -0,0 +1,139 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
from ansible import constants as C
|
||||
from ansible.utils.color import colorize, hostcolor
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
class CallbackModule(CallbackBase):
|
||||
CALLBACK_VERSION = 2.0
|
||||
CALLBACK_TYPE = 'notification'
|
||||
CALLBACK_NAME = 'hello_bob'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CallbackModule, self).__init__()
|
||||
|
||||
|
||||
def v2_playbook_on_start(self, playbook):
|
||||
self._display.display("Custom commands for <v2_playbook_on_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_task_start(self, task, is_conditional):
|
||||
self._display.display("Custom commands for <v2_playbook_on_task_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_stats(self, stats):
|
||||
self._display.display("Custom commands for <v2_playbook_on_stats> go here", color=C.COLOR_OK)
|
||||
|
||||
###################################################################################################################
|
||||
|
||||
def v2_on_any(self, *args, **kwargs):
|
||||
self._display.display("Custom commands for <v2_on_any> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_failed(self, result, ignore_errors=False):
|
||||
self._display.display("Custom commands for <v2_runner_on_failed> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_ok(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_on_ok> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_skipped(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_on_skipped> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_unreachable(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_on_unreachable> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_async_poll(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_on_async_poll> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_async_ok(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_on_async_ok> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_async_failed(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_on_async_failed> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_start(self, playbook):
|
||||
self._display.display("Custom commands for <v2_playbook_on_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_notify(self, handler, host):
|
||||
self._display.display("Custom commands for <v2_playbook_on_notify> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_no_hosts_matched(self):
|
||||
self._display.display("Custom commands for <v2_playbook_on_no_hosts_matched> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_no_hosts_remaining(self):
|
||||
self._display.display("Custom commands for <v2_playbook_on_no_hosts_remaining> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_task_start(self, task, is_conditional):
|
||||
self._display.display("Custom commands for <v2_playbook_on_task_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_cleanup_task_start(self, task):
|
||||
self._display.display("Custom commands for <v2_playbook_on_cleanup_task_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_handler_task_start(self, task):
|
||||
self._display.display("Custom commands for <v2_playbook_on_handler_task_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None, unsafe=None):
|
||||
self._display.display("Custom commands for <v2_playbook_on_vars_prompt> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_import_for_host(self, result, imported_file):
|
||||
self._display.display("Custom commands for <v2_playbook_on_import_for_host> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_not_import_for_host(self, result, missing_file):
|
||||
self._display.display("Custom commands for <v2_playbook_on_not_import_for_host> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_play_start(self, play):
|
||||
self._display.display("Custom commands for <v2_playbook_on_play_start> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_stats(self, stats):
|
||||
self._display.display("Custom commands for <v2_playbook_on_stats> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_on_file_diff(self, result):
|
||||
self._display.display("Custom commands for <v2_on_file_diff> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_playbook_on_include(self, included_file):
|
||||
self._display.display("Custom commands for <v2_playbook_on_include> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_item_on_ok(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_item_on_ok> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_item_on_failed(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_item_on_failed> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_item_on_skipped(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_item_on_skipped> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_retry(self, result):
|
||||
self._display.display("Custom commands for <v2_runner_retry> go here", color=C.COLOR_OK)
|
||||
|
||||
|
||||
def v2_runner_on_start(self, host, task):
|
||||
self._display.display("Custom commands for <v2_runner_on_start> go here", color=C.COLOR_OK)
|
||||
|
Reference in New Issue
Block a user