1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

add option to display per host start to default (#53819)

* add option to display per host start to default
This commit is contained in:
Brian Coca 2019-04-12 12:42:38 -04:00 committed by GitHub
parent 5eb3117822
commit 9f87552f06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- Add toggle to show per host task start on default callback

View file

@ -227,6 +227,10 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_handler_task_start(self, task):
self._task_start(task, prefix='RUNNING HANDLER')
def v2_runner_on_start(self, host, task):
if self.get_option('show_per_host_start'):
self._display.display(" [started %s on %s]" % (task, host), color=C.COLOR_OK)
def v2_playbook_on_play_start(self, play):
name = play.get_name().strip()
if not name:

View file

@ -55,4 +55,15 @@ class ModuleDocFragment(object):
ini:
- key: show_custom_stats
section: defaults
show_per_host_start:
name: Show per host task start
description: 'This adds output that shows when a task is started to execute for each host'
type: bool
default: no
env:
- name: ANSIBLE_SHOW_PER_HOST_START
ini:
- key: show_per_host_start
section: defaults
version_added: '2.9'
'''

View file

@ -12,5 +12,5 @@
- assert:
that:
- "pbexec_json.rc == 0"
- "pbexec_json.events|length == 6"
- "pbexec_json.events|length == 7"
- "'localhost' in pbexec_json.stats.ok"