diff --git a/changelogs/fragments/async_status_env.yaml b/changelogs/fragments/async_status_env.yaml new file mode 100644 index 00000000000..42f163437f4 --- /dev/null +++ b/changelogs/fragments/async_status_env.yaml @@ -0,0 +1,2 @@ +bugfixes: +- async - Ensure that the implicit async_status gets the env from a task with async (https://github.com/ansible/ansible/pull/39764) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 642e05c51d5..577792eb965 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -703,7 +703,7 @@ class TaskExecutor: # that (with a sleep for "poll" seconds between each retry) until the # async time limit is exceeded. - async_task = Task().load(dict(action='async_status jid=%s' % async_jid)) + async_task = Task().load(dict(action='async_status jid=%s' % async_jid, environment=self._task.environment)) # FIXME: this is no longer the case, normal takes care of all, see if this can just be generalized # Because this is an async task, the action handler is async. However,