diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index cdee3f045e..2504a179fc 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -61,6 +61,8 @@ class TaskQueueManager: self._stats = AggregateStats() self.passwords = passwords self._stdout_callback = stdout_callback + + self._callbacks_loaded = False self._callback_plugins = [] # a special flag to help us exit cleanly @@ -123,6 +125,9 @@ class TaskQueueManager: only one such callback plugin will be loaded. ''' + if self._callbacks_loaded: + return + stdout_callback_loaded = False if self._stdout_callback is None: self._stdout_callback = C.DEFAULT_STDOUT_CALLBACK @@ -148,6 +153,8 @@ class TaskQueueManager: else: self._callback_plugins.append(callback_plugin()) + self._callbacks_loaded = True + def _do_var_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): if prompt and default is not None: @@ -201,6 +208,9 @@ class TaskQueueManager: are done with the current task). ''' + if not self._callbacks_loaded: + self.load_callbacks() + if play.vars_prompt: for var in play.vars_prompt: if 'name' not in var: