Skip to content

Commit

Permalink
🎉 Init ansible module
Browse files Browse the repository at this point in the history
  • Loading branch information
Searge committed Apr 1, 2024
1 parent a087874 commit 539085b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ansible/callback_plugins/rich_callback_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from ansible.plugins.callback import CallbackBase


class CallbackModule(CallbackBase):
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = "stdout"
CALLBACK_NAME = "rich_callback_plugin"

def __init__(self, display=None):
super(CallbackModule, self).__init__(display)

def v2_runner_on_ok(self, result, **kwargs):
self._display.display(
"Task completed successfully: %s" % result._task.get_name()
)

def v2_runner_on_failed(self, result, **kwargs):
self._display.display("Task failed: %s" % result._task.get_name())

# You can add more methods to handle other events like
# v2_runner_on_unreachable, v2_playbook_on_start, etc.

0 comments on commit 539085b

Please sign in to comment.