diff --git a/test/integration/roles/setup_ec2/tasks/main.yml b/test/integration/roles/setup_ec2/tasks/main.yml
index 7e80677def7..a41ce0963ef 100644
--- a/test/integration/roles/setup_ec2/tasks/main.yml
+++ b/test/integration/roles/setup_ec2/tasks/main.yml
@@ -17,7 +17,7 @@
# along with Ansible. If not, see .
- name: generate random string
- command: python -c "import string,random; print ''.join(random.choice(string.ascii_lowercase) for _ in range(8));"
+ command: '{{ ansible_python.executable }} -c "import string,random; print ''.join(random.choice(string.ascii_lowercase) for _ in range(8));"'
register: random_string
tags:
- prepare
diff --git a/test/integration/roles/test_get_url/tasks/main.yml b/test/integration/roles/test_get_url/tasks/main.yml
index a601ef1e993..e19ec8ab4a7 100644
--- a/test/integration/roles/test_get_url/tasks/main.yml
+++ b/test/integration/roles/test_get_url/tasks/main.yml
@@ -17,7 +17,7 @@
# along with Ansible. If not, see .
- name: Determine if python looks like it will support modern ssl features like SNI
- command: python -c 'from ssl import SSLContext'
+ command: "{{ ansible_python.executable }} -c 'from ssl import SSLContext'"
ignore_errors: True
register: python_test
diff --git a/test/integration/roles/test_pip/tasks/main.yml b/test/integration/roles/test_pip/tasks/main.yml
index 6b1597dd8ba..b95c52c4359 100644
--- a/test/integration/roles/test_pip/tasks/main.yml
+++ b/test/integration/roles/test_pip/tasks/main.yml
@@ -37,7 +37,7 @@
that:
- "not uninstall_result.changed"
-- shell: "python -c 'import {{ pip_test_package }}'"
+- shell: "{{ ansible_python.executable }} -c 'import {{ pip_test_package }}'"
register: absent_result
ignore_errors: True
@@ -58,7 +58,7 @@
that:
- "install_result.changed == True"
-- shell: "python -c 'import {{ pip_test_package }}'"
+- shell: "{{ ansible_python.executable }} -c 'import {{ pip_test_package }}'"
register: installed_result
# now remove it to test uninstallation of a package we are sure is installed
diff --git a/test/integration/roles/test_template/tasks/main.yml b/test/integration/roles/test_template/tasks/main.yml
index f29d8b474c9..133690ff05f 100644
--- a/test/integration/roles/test_template/tasks/main.yml
+++ b/test/integration/roles/test_template/tasks/main.yml
@@ -42,7 +42,7 @@
# VERIFY CONTENTS
- name: check what python version ansible is running on
- command: python -c 'import distutils.sysconfig ; print(distutils.sysconfig.get_python_version())'
+ command: "{{ ansible_python.executable }} -c 'import distutils.sysconfig ; print(distutils.sysconfig.get_python_version())'"
register: pyver
delegate_to: localhost
diff --git a/test/integration/roles/test_until/tasks/main.yml b/test/integration/roles/test_until/tasks/main.yml
index b0e0c5d2331..74a214756dd 100644
--- a/test/integration/roles/test_until/tasks/main.yml
+++ b/test/integration/roles/test_until/tasks/main.yml
@@ -1,4 +1,4 @@
-- shell: python -c "import tempfile; print(tempfile.mkstemp()[1])"
+- shell: '{{ ansible_python.executable }} -c "import tempfile; print(tempfile.mkstemp()[1])"'
register: tempfilepath
- set_fact: