From de16d1434b8529ba0d868baf023be7f39864b488 Mon Sep 17 00:00:00 2001 From: Marc Gariepy Date: Tue, 9 Jun 2020 14:50:52 -0400 Subject: [PATCH] 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 Change-Id: I228ac8f4e02f0d344f524e093433414290ecb67f --- scripts/bootstrap-ansible.sh | 8 +++++++- scripts/openstack-ansible.rc | 1 + zuul.d/playbooks/pre-gate-cleanup.yml | 24 ------------------------ zuul.d/playbooks/vars/debian.yml | 19 ------------------- zuul.d/playbooks/vars/redhat.yml | 17 ----------------- 5 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 zuul.d/playbooks/vars/debian.yml delete mode 100644 zuul.d/playbooks/vars/redhat.yml diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index dcd63a017a..cfc5b95968 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -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 @@ -80,13 +81,17 @@ case ${DISTRO_ID} in if `/bin/grep -q "stretch" /etc/os-release` && [ -f "/etc/apt/sources.list.d/security.list" ]; then echo "deb http://security.debian.org stretch/updates main contrib" > /etc/apt/sources.list.d/security.list fi - # NOTE(jrosser) remove this once infra debian repos are fixed for buster + # NOTE(jrosser) remove this once infra debian repos are fixed for buster if `/bin/grep -q "buster" /etc/os-release` && [ -f "/etc/apt/sources.list.d/security.list" ]; then echo "deb http://deb.debian.org/debian buster main" > /etc/apt/sources.list.d/default.list echo "deb http://deb.debian.org/debian buster-backports" main > /etc/apt/sources.list.d/backports.list 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 diff --git a/scripts/openstack-ansible.rc b/scripts/openstack-ansible.rc index ea34699762..68710d67e9 100644 --- a/scripts/openstack-ansible.rc +++ b/scripts/openstack-ansible.rc @@ -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}" diff --git a/zuul.d/playbooks/pre-gate-cleanup.yml b/zuul.d/playbooks/pre-gate-cleanup.yml index 5daa18394d..ffb0d5d826 100644 --- a/zuul.d/playbooks/pre-gate-cleanup.yml +++ b/zuul.d/playbooks/pre-gate-cleanup.yml @@ -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') }}" diff --git a/zuul.d/playbooks/vars/debian.yml b/zuul.d/playbooks/vars/debian.yml deleted file mode 100644 index ea28458b12..0000000000 --- a/zuul.d/playbooks/vars/debian.yml +++ /dev/null @@ -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 diff --git a/zuul.d/playbooks/vars/redhat.yml b/zuul.d/playbooks/vars/redhat.yml deleted file mode 100644 index f19820ce2f..0000000000 --- a/zuul.d/playbooks/vars/redhat.yml +++ /dev/null @@ -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