diff --git a/lib/ansible/executor/playbook_executor.py b/lib/ansible/executor/playbook_executor.py index dd15039ad68..e6bde76c4d9 100644 --- a/lib/ansible/executor/playbook_executor.py +++ b/lib/ansible/executor/playbook_executor.py @@ -183,6 +183,7 @@ class PlaybookExecutor: finally: if self._tqm is not None: + self._tqm.send_callback('v2_playbook_on_stats', self._tqm._stats) self._cleanup() if self._options.syntax: diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index 405a8c7b3a7..edc97f1a601 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -107,9 +107,7 @@ class StrategyBase: failed_hosts = set(failed_hosts).union(self._tqm._failed_hosts.keys()) unreachable_hosts = set(unreachable_hosts).union(self._tqm._unreachable_hosts.keys()) - # send the stats callback - self._tqm.send_callback('v2_playbook_on_stats', self._tqm._stats) - + # return the appropriate code, depending on the status hosts after the run if len(unreachable_hosts) > 0: return 3 elif len(failed_hosts) > 0: