auto-detect interpreter

setting ANSIBLE_PYTHON_INTERPRETER to auto will use the value from the
ansible/config/base.yml

debian gets a /usr/bin/python3 for now and need to revisit once we have
ansible 2.10.

Change-Id: I503c1b71c0d01eea668500c0125c752c0584a7ef
Co-Authored-By: Jonathan Rosser <jonathan.rosser@rd.bbc.co.uk>
This commit is contained in:
Marc Gariepy 2020-06-09 15:09:12 -04:00
parent db14a6ffd6
commit 0a244ca090
4 changed files with 10 additions and 4 deletions

View File

@ -136,7 +136,6 @@
- item['scm'] == "git" or item['scm'] is undefined
vars:
ansible_python_interpreter: "/usr/bin/python3"
homedir: "{{ lookup('env', 'TESTING_HOME') }}"
role_file: "{{ lookup('env', 'ANSIBLE_ROLE_REQUIREMENTS_PATH') }}"
osa_roles: "{{ lookup('file', role_file) | from_yaml }}"

View File

@ -29,6 +29,15 @@
set -e
## Vars ----------------------------------------------------------------------
# Source distribution information
source /etc/os-release || source /usr/lib/os-release
#TODO: cleanup on ansible 2.10 if debian is in config/base.yml
if [ "${ID}" == "debian" ] && [ "${VERSION_ID}" == "10" ]; then
ANSIBLE_PYTHON_INTERPRETER="/usr/bin/python3"
fi
export ANSIBLE_PYTHON_INTERPRETER=${ANSIBLE_PYTHON_INTERPRETER:-auto}
export TESTING_HOME=${TESTING_HOME:-$HOME}
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
@ -48,6 +57,7 @@ echo "ANSIBLE_PARAMETERS: ${ANSIBLE_PARAMETERS}"
echo "TEST_PLAYBOOK: ${TEST_PLAYBOOK}"
echo "TEST_CHECK_MODE: ${TEST_CHECK_MODE}"
echo "TEST_IDEMPOTENCE: ${TEST_IDEMPOTENCE}"
echo "ANSIBLE_PYTHON_INTERPRETER: ${ANSIBLE_PYTHON_INTERPRETER}"
## Functions -----------------------------------------------------------------

View File

@ -29,8 +29,6 @@
become: no
gather_facts: false
any_errors_fatal: true
vars:
ansible_python_interpreter: "{{ ansible_playbook_python }}"
vars_files:
- test-vars.yml
tasks:

View File

@ -21,4 +21,3 @@ bridges:
ip_addr: "10.1.2.1"
veth_peer: "veth-test"
ansible_python_interpreter: "/usr/bin/python"