diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index ceeee7bcd..421a0789a 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -42,9 +42,15 @@ when: (ansible_os_family | search("SUSE LINUX")) or (ansible_os_family | search("openSUSE Leap")) +# NOTE(hwoarang) The 'apt' module needs python-apt installed in the virtualenv +# but it's not possible to do that. See https://github.com/ansible/ansible/issues/14468 +# python-apt only works if it's installed on the local system so we need to switch the +# Ansible python interpreter. - name: "Update apt cache if Ubuntu/Debian" apt: update_cache: yes + vars: + ansible_python_interpreter: '/usr/bin/python' when: ansible_os_family == "Debian" - name: "Load distribution defaults" @@ -72,9 +78,15 @@ ansible_pkg_mgr: "dnf" when: ansible_distribution == 'Fedora' and test_dnf.stat.exists|bool +# NOTE(hwoarang) The 'apt' module needs python-apt installed in the virtualenv +# but it's not possible to do that. See https://github.com/ansible/ansible/issues/14468 +# python-apt only works if it's installed on the local system so we need to switch the +# Ansible python interpreter. - name: "Install required packages" action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: "{{ required_packages }}" + vars: + ansible_python_interpreter: '/usr/bin/python' - include: prepare_libvirt.yml diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 2b63fe135..086ed0e3b 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -105,9 +105,11 @@ if [ ${USE_VENV} = "true" ]; then set -u ANSIBLE=${VENV}/bin/ansible-playbook ENABLE_VENV="true" + ANSIBLE_PYTHON_INTERP=${VENV}/bin/python else $SCRIPT_HOME/env-setup.sh ANSIBLE=${HOME}/.local/bin/ansible-playbook + ANSIBLE_PYTHON_INTERP=$(which python) fi # Adjust options for DHCP, VM, or Keystone tests @@ -157,6 +159,7 @@ done ${ANSIBLE} -vvvv \ -i inventory/localhost \ test-bifrost-create-vm.yaml \ + -e ansible_python_interpreter="${ANSIBLE_PYTHON_INTERP}" \ -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ -e test_vm_memory_size=${VM_MEMORY_SIZE} \ -e test_vm_domain_type=${VM_DOMAIN_TYPE} \