From 40509c16bc57dbe74d7a6ce2a0d528eb66d2fb72 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Thu, 2 Jan 2020 14:30:32 -0800 Subject: [PATCH] Set apt use to python3. We had python hard coded instead of allowing ansible to autodiscover the version of python to use. :( Change-Id: I3fbd873ee72cb3783bcb77ef14478fea302ffa3a --- playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml | 6 +++--- playbooks/roles/venv_python_path/tasks/main.yml | 4 ++-- scripts/test-bifrost.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index 421a0789a..78b0510a7 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -49,9 +49,9 @@ - name: "Update apt cache if Ubuntu/Debian" apt: update_cache: yes - vars: - ansible_python_interpreter: '/usr/bin/python' when: ansible_os_family == "Debian" + vars: + ansible_python_interpreter: '/usr/bin/python3' - name: "Load distribution defaults" include_vars: "{{ item }}" @@ -86,7 +86,7 @@ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: "{{ required_packages }}" vars: - ansible_python_interpreter: '/usr/bin/python' + ansible_python_interpreter: '/usr/bin/python3' - include: prepare_libvirt.yml diff --git a/playbooks/roles/venv_python_path/tasks/main.yml b/playbooks/roles/venv_python_path/tasks/main.yml index a81b03615..e818a9927 100644 --- a/playbooks/roles/venv_python_path/tasks/main.yml +++ b/playbooks/roles/venv_python_path/tasks/main.yml @@ -16,8 +16,8 @@ enable_venv: true when: lookup('env', 'VENV') | length > 0 -- name: "Retrieve venv python path" - shell: "/bin/echo -e \"import sys\\nprint(':'.join(sys.path))\" | {{ ansible_python.get('executable', '/usr/bin/python').split('/')[-1] }}" +- name: "Retrieve venv python3 path" + shell: "/bin/echo -e \"import sys\\nprint(':'.join(sys.path))\" | {{ ansible_python.get('executable', '/usr/bin/python3').split('/')[-1] }}" environment: "{{ bifrost_venv_env | default({}) }}" register: venv_pythonpath_result when: enable_venv diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index be33d4025..d95129b1c 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -92,11 +92,11 @@ if [ ${USE_VENV} = "true" ]; then set -u ANSIBLE=${VENV}/bin/ansible-playbook ENABLE_VENV="true" - ANSIBLE_PYTHON_INTERP=${VENV}/bin/python + ANSIBLE_PYTHON_INTERP=${VENV}/bin/python3 else $SCRIPT_HOME/env-setup.sh ANSIBLE=${HOME}/.local/bin/ansible-playbook - ANSIBLE_PYTHON_INTERP=$(which python) + ANSIBLE_PYTHON_INTERP=$(which python3) fi # Adjust options for DHCP, VM, or Keystone tests