From 9dba580204fcc7d95d4ca2ea2ae4ce23fe28c2ed Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 16 Oct 2017 16:59:56 -0400 Subject: [PATCH] correctly deal with changed --- lib/ansible/executor/task_result.py | 2 +- lib/ansible/plugins/callback/__init__.py | 5 ++++- lib/ansible/plugins/callback/default.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/executor/task_result.py b/lib/ansible/executor/task_result.py index 72380de7150..efac78f9455 100644 --- a/lib/ansible/executor/task_result.py +++ b/lib/ansible/executor/task_result.py @@ -10,7 +10,7 @@ from copy import deepcopy from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import strip_internal_keys -_IGNORE = ('changed', 'failed', 'skipped') +_IGNORE = ('failed', 'skipped') class TaskResult: diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index 76bafd59326..0376253a238 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -218,7 +218,10 @@ class CallbackBase(AnsiblePlugin): def _clean_results(self, result, task_name): ''' removes data from results for display ''' - pass + if task_name in ['debug']: + for remove_key in ('invocation'): + if remove_key in result: + del result[remove_key] def set_play_context(self, play_context): pass diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py index 03c5f495b5b..2cd5cb6e857 100644 --- a/lib/ansible/plugins/callback/default.py +++ b/lib/ansible/plugins/callback/default.py @@ -95,6 +95,8 @@ class CallbackModule(CallbackBase): else: if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result: + if result._task.action == 'debug' and 'changed' in result._result: + del result._result['changed'] msg += " => %s" % (self._dump_results(result._result),) self._display.display(msg, color=color)