From c1c02f67dcb28a8722d505ddf6a24a37c1f874d7 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 9 Apr 2019 09:23:14 +0100 Subject: [PATCH] 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 --- ansible/roles/baremetal/defaults/main.yml | 7 +++++++ ansible/roles/baremetal/tasks/install.yml | 1 + 2 files changed, 8 insertions(+) diff --git a/ansible/roles/baremetal/defaults/main.yml b/ansible/roles/baremetal/defaults/main.yml index c65e530cff..4627672f51 100644 --- a/ansible/roles/baremetal/defaults/main.yml +++ b/ansible/roles/baremetal/defaults/main.yml @@ -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 diff --git a/ansible/roles/baremetal/tasks/install.yml b/ansible/roles/baremetal/tasks/install.yml index 90a84f740c..7c0f85cf20 100644 --- a/ansible/roles/baremetal/tasks/install.yml +++ b/ansible/roles/baremetal/tasks/install.yml @@ -108,6 +108,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: