Skip to content

Commit

Permalink
auto-detect interpreter.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
2 people authored and Dmitriy Rabotyagov committed Jun 15, 2020
1 parent ca9e05f commit de16d14
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 61 deletions.
8 changes: 7 additions & 1 deletion scripts/bootstrap-ansible.sh
Expand Up @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions scripts/openstack-ansible.rc
Expand Up @@ -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}"
24 changes: 0 additions & 24 deletions zuul.d/playbooks/pre-gate-cleanup.yml
Expand Up @@ -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:
Expand All @@ -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') }}"
Expand Down
19 changes: 0 additions & 19 deletions zuul.d/playbooks/vars/debian.yml

This file was deleted.

17 changes: 0 additions & 17 deletions zuul.d/playbooks/vars/redhat.yml

This file was deleted.

0 comments on commit de16d14

Please sign in to comment.