auto-detect interpreter.

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

debian is not included for this release of ansible but it whould work
for centos 6,7,8 and also for ubuntu 18,20.

Patch also removes pre-gate cleanup tasks for the new plain CI images[1]

[1] http://lists.openstack.org/pipermail/openstack-discuss/2020-May/015157.html

Co-Authored-By: Jonathan Rosser <jonathan.rosser@rd.bbc.co.uk>
Change-Id: I228ac8f4e02f0d344f524e093433414290ecb67f
This commit is contained in:
Marc Gariepy 2020-06-09 14:50:52 -04:00 committed by Dmitriy Rabotyagov
parent ca9e05fb68
commit de16d1434b
5 changed files with 8 additions and 61 deletions

View File

@ -55,6 +55,7 @@ export OSA_CLONE_DIR="$(pwd)"
ANSIBLE_ROLE_FILE="$(readlink -f "${ANSIBLE_ROLE_FILE}")"
OSA_INVENTORY_PATH="$(readlink -f inventory)"
OSA_PLAYBOOK_PATH="$(readlink -f playbooks)"
OSA_ANSIBLE_PYTHON_INTERPRETER="auto"
# Create the ssh dir if needed
ssh_key_create
@ -87,6 +88,10 @@ case ${DISTRO_ID} in
echo "deb http://security.debian.org buster/updates main contrib" > /etc/apt/sources.list.d/security.list
echo "deb http://deb.debian.org/debian buster-updates main" > /etc/apt/sources.list.d/updates.list
fi
# NOTE(mgariepy) remove this on ansible 2.10 if debian is in the config/base.yml file
if `/bin/grep -q "buster" /etc/os-release`; then
OSA_ANSIBLE_PYTHON_INTERPRETER="/usr/bin/python3"
fi
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install \
git-core curl gcc netcat \
@ -160,6 +165,7 @@ popd
# Write the OSA Ansible rc file
sed "s|OSA_INVENTORY_PATH|${OSA_INVENTORY_PATH}|g" scripts/openstack-ansible.rc > /usr/local/bin/openstack-ansible.rc
sed -i "s|OSA_PLAYBOOK_PATH|${OSA_PLAYBOOK_PATH}|g" /usr/local/bin/openstack-ansible.rc
sed -i "s|OSA_ANSIBLE_PYTHON_INTERPRETER|${OSA_ANSIBLE_PYTHON_INTERPRETER}|g" /usr/local/bin/openstack-ansible.rc
# Create openstack ansible wrapper tool
cp -v ${OSA_WRAPPER_BIN} /usr/local/bin/openstack-ansible

View File

@ -57,3 +57,4 @@ export ANSIBLE_STRATEGY_PLUGINS="${ANSIBLE_STRATEGY_PLUGINS:-/etc/ansible/roles/
export ANSIBLE_CONNECTION_PLUGINS="${ANSIBLE_CONNECTION_PLUGINS:-/etc/ansible/roles/plugins/connection}"
export ANSIBLE_FORCE_HANDLERS="${ANSIBLE_FORCE_HANDLERS:-True}"
export ANSIBLE_PYTHON_INTERPRETER="${ANSIBLE_PYTHON_INTERPRETER:-OSA_ANSIBLE_PYTHON_INTERPRETER}"

View File

@ -21,8 +21,6 @@
- name: Cleanup gate images
block:
- name: Gather variables for each operating system
include_vars: "{{ ansible_os_family | lower }}.yml"
- name: Switch apt source from https to http
replace:
@ -32,28 +30,6 @@
when:
- ansible_distribution_release in ['bionic']
- name: Remove known problem distro packages
package:
name: "{{ gate_packages_remove }}"
state: absent
- name: Remove known problem pip packages
pip:
name:
- virtualenv
- tox
- appdirs
- contextlib2
- distlib
- filelock
- importlib_metadata
- importlib_resources
- six
- zipp
- backports
state: absent
when: ansible_os_family | lower in ['debian', 'redhat']
- name: Remove package blacklist for yum/dnf
lineinfile:
dest: "{{ (ansible_pkg_mgr == 'dnf') | ternary('/etc/dnf/dnf.conf', '/etc/yum.conf') }}"

View File

@ -1,19 +0,0 @@
---
# Copyright 2020, VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
gate_packages_remove:
- python-virtualenv
- python3-virtualenv
- virtualenv

View File

@ -1,17 +0,0 @@
---
# Copyright 2020, VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
gate_packages_remove:
- python-virtualenv