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: