From 3203d19c38eabafde047753b805c31174ec33b17 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 (cherry picked from commit c1c02f67dcb28a8722d505ddf6a24a37c1f874d7) --- ansible/roles/baremetal/defaults/main.yml | 7 +++++++ ansible/roles/baremetal/tasks/install.yml | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ansible/roles/baremetal/defaults/main.yml b/ansible/roles/baremetal/defaults/main.yml index 2a925af404..54b42e3daa 100644 --- a/ansible/roles/baremetal/defaults/main.yml +++ b/ansible/roles/baremetal/defaults/main.yml @@ -73,9 +73,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..b6def4ea49 100644 --- a/ansible/roles/baremetal/tasks/install.yml +++ b/ansible/roles/baremetal/tasks/install.yml @@ -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: