diff --git a/lib/ansible/executor/playbook_executor.py b/lib/ansible/executor/playbook_executor.py index d109b5296a5..30d9ad6d6b8 100644 --- a/lib/ansible/executor/playbook_executor.py +++ b/lib/ansible/executor/playbook_executor.py @@ -172,22 +172,22 @@ class PlaybookExecutor: if entry: entrylist.append(entry) # per playbook - if C.RETRY_FILES_ENABLED: - retries = list(set(self._tqm._failed_hosts.keys() + self._tqm._unreachable_hosts.keys())) - retries.sort() - if len(retries) > 0: - if C.RETRY_FILES_SAVE_PATH: - basedir = C.shell_expand(C.RETRY_FILES_SAVE_PATH) - else: - basedir = os.path.dirname(playbook_path) - - (retry_name, _) = os.path.splitext(os.path.basename(playbook_path)) - filename = os.path.join(basedir, "%s.retry" % retry_name) - if self._generate_retry_inventory(filename, retries): - display.display("\tto retry, use: --limit @%s\n" % filename) - # send the stats callback for this playbook if self._tqm is not None: + if C.RETRY_FILES_ENABLED: + retries = list(set(self._tqm._failed_hosts.keys() + self._tqm._unreachable_hosts.keys())) + retries.sort() + if len(retries) > 0: + if C.RETRY_FILES_SAVE_PATH: + basedir = C.shell_expand(C.RETRY_FILES_SAVE_PATH) + else: + basedir = os.path.dirname(playbook_path) + + (retry_name, _) = os.path.splitext(os.path.basename(playbook_path)) + filename = os.path.join(basedir, "%s.retry" % retry_name) + if self._generate_retry_inventory(filename, retries): + display.display("\tto retry, use: --limit @%s\n" % filename) + self._tqm.send_callback('v2_playbook_on_stats', self._tqm._stats) # if the last result wasn't zero, break out of the playbook file name loop