mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
allow config for callbaks and some fixes
* only complain about ini deprecation if value is set * set plugin config for stdout and other types * updated plugin docs, moved several plugins to new config * finished ssh docs * fixed some issues seen in plugins while modifying docs * placeholder for 'required' * callbacks must use _plugin_options as _options already in use
This commit is contained in:
parent
942b6fb9bc
commit
869a318492
19 changed files with 480 additions and 402 deletions
|
@ -14,17 +14,17 @@ DOCUMENTATION:
|
|||
show_skipped_hosts:
|
||||
name: Show skipped hosts
|
||||
description: "Toggle to control displaying skipped task/host results in a task"
|
||||
default: True
|
||||
env:
|
||||
- name: DISPLAY_SKIPPED_HOSTS
|
||||
ini:
|
||||
- key: display_skipped_hosts
|
||||
section: defaults
|
||||
type: boolean
|
||||
default: True
|
||||
show_custom_stats:
|
||||
name: Show custom stats
|
||||
default: False
|
||||
description: 'This adds the custom stats set via the set_stats plugin to the play recap'
|
||||
default: False
|
||||
env:
|
||||
- name: ANSIBLE_SHOW_CUSTOM_STATS
|
||||
ini:
|
||||
|
@ -119,7 +119,7 @@ class CallbackModule(CallbackBase):
|
|||
self._display.display(msg, color=color)
|
||||
|
||||
def v2_runner_on_skipped(self, result):
|
||||
if C.DISPLAY_SKIPPED_HOSTS:
|
||||
if self._plugin_options['show_skipped_hosts']:
|
||||
|
||||
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
||||
self._clean_results(result._result, result._task.action)
|
||||
|
@ -248,7 +248,7 @@ class CallbackModule(CallbackBase):
|
|||
self._display.display(msg + " (item=%s) => %s" % (self._get_item(result._result), self._dump_results(result._result)), color=C.COLOR_ERROR)
|
||||
|
||||
def v2_runner_item_on_skipped(self, result):
|
||||
if C.DISPLAY_SKIPPED_HOSTS:
|
||||
if self._plugin_options['show_skipped_hosts']:
|
||||
self._clean_results(result._result, result._task.action)
|
||||
msg = "skipping: [%s] => (item=%s) " % (result._host.get_name(), self._get_item(result._result))
|
||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||
|
@ -287,7 +287,7 @@ class CallbackModule(CallbackBase):
|
|||
self._display.display("", screen_only=True)
|
||||
|
||||
# print custom stats
|
||||
if C.SHOW_CUSTOM_STATS and stats.custom:
|
||||
if self._plugin_options['show_custom_stats'] and stats.custom:
|
||||
self._display.banner("CUSTOM STATS: ")
|
||||
# per host
|
||||
# TODO: come up with 'pretty format'
|
||||
|
@ -308,11 +308,11 @@ class CallbackModule(CallbackBase):
|
|||
self._display.banner("PLAYBOOK: %s" % basename(playbook._file_name))
|
||||
|
||||
if self._display.verbosity > 3:
|
||||
if self._options is not None:
|
||||
for option in dir(self._options):
|
||||
if self._plugin_options is not None:
|
||||
for option in dir(self._plugin_options):
|
||||
if option.startswith('_') or option in ['read_file', 'ensure_value', 'read_module']:
|
||||
continue
|
||||
val = getattr(self._options, option)
|
||||
val = getattr(self._plugin_options, option)
|
||||
if val:
|
||||
self._display.vvvv('%s: %s' % (option, val))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue