summaryrefslogtreecommitdiff
path: root/lib/ansible/executor
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2021-05-14 10:19:55 -0400
committerGitHub <noreply@github.com>2021-05-14 10:19:55 -0400
commit173d0a8de74f6124696282a6e40037f16c49efc2 (patch)
treee6d09394d9893e52db75312babc4d1bbacbafcd8 /lib/ansible/executor
parent51b56595986b6ea5ecc23ef85214a400a24eb64c (diff)
downloadansible-173d0a8de74f6124696282a6e40037f16c49efc2.tar.gz
Skip interpreter discovery for network OSs(#74012)
skip python interpreter discovery on network os being set as this indicates a 'forced local' module and should use sys.executable.
Diffstat (limited to 'lib/ansible/executor')
-rw-r--r--lib/ansible/executor/task_executor.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py
index 987ae4dc3d..781394fa96 100644
--- a/lib/ansible/executor/task_executor.py
+++ b/lib/ansible/executor/task_executor.py
@@ -539,6 +539,12 @@ class TaskExecutor:
plugin_vars = self._set_connection_options(cvars, templar)
templar.available_variables = orig_vars
+ # TODO: eventually remove this block as this should be a 'consequence' of 'forced_local' modules
+ # special handling for python interpreter for network_os, default to ansible python unless overriden
+ if 'ansible_network_os' in cvars and 'ansible_python_interpreter' not in cvars:
+ # this also avoids 'python discovery'
+ cvars['ansible_python_interpreter'] = sys.executable
+
# get handler
self._handler = self._get_action_handler(connection=self._connection, templar=templar)