zuul-jobs/roles/ensure-pip/tasks/workarounds.yaml
Ian Wienand b4c195b419 ensure-pip: use python2-pip when running under Python 2
When Ansible runs under Python 2, such as on SuSE 15, we need
python2-pip for pip: to work.  Update the default to install Python 2
deps when Ansible is running under v2.

Additionally for SuSE, as described inline we can have pip but not
setuptools.  Put in a work-around to always pull in the setuptools
package.  Pull this out into a separate file; history has shown that
we may need more :/

Change-Id: I450171aad5e31d2925239ab3d0641cd23f6815a2
2020-05-05 09:27:24 +10:00

19 lines
668 B
YAML

#
# This file contains workaround tasks for specific issues
#
# Somehow on SuSE 15 the dependencies are such that python2-pip can be
# installed, but setuptools is not. This breaks Ansible's pip: which
# does a direct import of pkg_resources and thus has a hard-dependency
# on setuptools. This doesn't appear to happen for python3. Thus we
# ensure this is installed, even if we skipped install phase because
# pip looked like it was installed already.
- name: Ensure setuptools
package:
name: python-setuptools
become: yes
when:
- ansible_python.version.major == 2
- ansible_os_family == 'Suse'
- ansible_distribution_major_version == '15'