Don't use easy_install on Ubuntu 18+

Currently easy_install is not available on Ubuntu 18+ due to [1]. In
that case, install pip via apt rather than easy_install.

[1]
https://bugs.launchpad.net/ubuntu/+source/python-setuptools/+bug/1774419

Change-Id: Id358fdb655d71490b0915680dff131cfe33f4a40
Closes-Bug: #1813492
(cherry picked from commit c1c02f67dc)
This commit is contained in:
Mark Goddard 2019-04-09 09:23:14 +01:00
parent 89224eecc1
commit 17a634af58
2 changed files with 11 additions and 1 deletions

View File

@ -68,9 +68,16 @@ docker_custom_option: ""
docker_runtime_directory: ""
# Ubuntu 18+ does not have easy_install available due to
# https://bugs.launchpad.net/ubuntu/+source/python-setuptools/+bug/1774419.
easy_install_available: >-
{{ ansible_distribution != 'Ubuntu' or
ansible_distribution_major_version is version(18, 'lt') }}
debian_pkg_install:
- "{{ docker_apt_package }}"
- git
- "{% if not easy_install_available %}python-pip{% endif %}"
- python-setuptools
- ntp

View File

@ -49,7 +49,9 @@
state: present
become: True
with_items: "{{ debian_pkg_install }}"
when: ansible_os_family == 'Debian'
when:
- ansible_os_family == 'Debian'
- item != ""
register: apt_install_result
- name: Install deltarpm packages
@ -108,6 +110,7 @@
virtualenv: "{{ virtualenv is none | ternary(omit, virtualenv) }}"
virtualenv_site_packages: "{{ virtualenv is none | ternary(omit, virtualenv_site_packages) }}"
become: True
when: easy_install_available
- name: Install latest pip in the virtualenv
pip: