mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
- better variable precedence management - universal plugin option handling - also updated comments for future directions - leverage fragments for plugins - removed fact namespacing - added 'firendly name' field - updated missing descriptions - removed some unused yaml entries, updated others to reflect possible future - documented more plugins - allow reading docs using alias - short licenses - corrected args for 'all plugins' - fixed -a option for ansible-doc - updated vars plugins to allow docs - fixed 'gathering' - only set options IF connection - added path list and renamed pathspec mostly the diff is , vs : as separator - readded removed config entries that were deprecated but had no message ... and deprecated again - now deprecated entries give warning when set
78 lines
2.5 KiB
Python
78 lines
2.5 KiB
Python
# (c) 2015, Andrew Gaffney <andrew@agaffney.org>
|
|
# (c) 2017 Ansible Project
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
'''
|
|
DOCUMENTATION:
|
|
callback: actionable
|
|
type: stdout
|
|
short_description: shows only items that need attention
|
|
description:
|
|
- Use this callback when you dont care about OK nor Skipped.
|
|
- This callback suppreses any non Failed or Changed status.
|
|
version_added: "2.1"
|
|
requirements:
|
|
- set as stdout callback in configuration
|
|
'''
|
|
# Make coding more python3-ish
|
|
from __future__ import (absolute_import, division, print_function)
|
|
__metaclass__ = type
|
|
|
|
from ansible.plugins.callback.default import CallbackModule as CallbackModule_default
|
|
|
|
|
|
class CallbackModule(CallbackModule_default):
|
|
|
|
CALLBACK_VERSION = 2.0
|
|
CALLBACK_TYPE = 'stdout'
|
|
CALLBACK_NAME = 'actionable'
|
|
|
|
def __init__(self):
|
|
self.super_ref = super(CallbackModule, self)
|
|
self.super_ref.__init__()
|
|
self.last_task = None
|
|
self.shown_title = False
|
|
|
|
def v2_playbook_on_handler_task_start(self, task):
|
|
self.super_ref.v2_playbook_on_handler_task_start(task)
|
|
self.shown_title = True
|
|
|
|
def v2_playbook_on_task_start(self, task, is_conditional):
|
|
self.last_task = task
|
|
self.shown_title = False
|
|
|
|
def display_task_banner(self):
|
|
if not self.shown_title:
|
|
self.super_ref.v2_playbook_on_task_start(self.last_task, None)
|
|
self.shown_title = True
|
|
|
|
def v2_runner_on_failed(self, result, ignore_errors=False):
|
|
self.display_task_banner()
|
|
self.super_ref.v2_runner_on_failed(result, ignore_errors)
|
|
|
|
def v2_runner_on_ok(self, result):
|
|
if result._result.get('changed', False):
|
|
self.display_task_banner()
|
|
self.super_ref.v2_runner_on_ok(result)
|
|
|
|
def v2_runner_on_unreachable(self, result):
|
|
self.display_task_banner()
|
|
self.super_ref.v2_runner_on_unreachable(result)
|
|
|
|
def v2_runner_on_skipped(self, result):
|
|
pass
|
|
|
|
def v2_playbook_on_include(self, included_file):
|
|
pass
|
|
|
|
def v2_runner_item_on_ok(self, result):
|
|
if result._result.get('changed', False):
|
|
self.display_task_banner()
|
|
self.super_ref.v2_runner_item_on_ok(result)
|
|
|
|
def v2_runner_item_on_skipped(self, result):
|
|
pass
|
|
|
|
def v2_runner_item_on_failed(self, result):
|
|
self.display_task_banner()
|
|
self.super_ref.v2_runner_item_on_failed(result)
|