From 94028852d9b08def40d08871aec5cc2b3e5b1400 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 25 May 2013 00:27:23 +0200 Subject: [PATCH] Make debug module always verbose in playbooks Created a new flag 'verbose_always' handled by on_ok callback, similar to the 'verbose_override' flag used by the setup module. --- lib/ansible/callbacks.py | 4 +++- lib/ansible/runner/action_plugins/debug.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index 1468b3d1b58..8f5292c74e4 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -434,6 +434,7 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks): host_result2 = host_result.copy() host_result2.pop('invocation', None) + verbose_always = host_result2.pop('verbose_always', None) changed = host_result.get('changed', False) ok_or_changed = 'ok' if changed: @@ -441,7 +442,8 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks): # show verbose output for non-setup module results if --verbose is used msg = '' - if not self.verbose or host_result2.get("verbose_override",None) is not None: + if (not self.verbose or host_result2.get("verbose_override",None) is not + None) and verbose_always is None: if item: msg = "%s: [%s] => (item=%s)" % (ok_or_changed, host, item) else: diff --git a/lib/ansible/runner/action_plugins/debug.py b/lib/ansible/runner/action_plugins/debug.py index 62d5ca110a6..ac6bfa3d74f 100644 --- a/lib/ansible/runner/action_plugins/debug.py +++ b/lib/ansible/runner/action_plugins/debug.py @@ -46,4 +46,7 @@ class ActionModule(object): else: result = dict(msg=args['msg']) + # force flag to make debug output module always verbose + result['verbose_always'] = True + return ReturnData(conn=conn, result=result)