Jeremy Stanley 2d9d24d07d Also pin pip/setuptools when creating Xenial venvs
We still have some Ubuntu Xenial servers, so cap the max usable pip
and setuptools versions in their venvs like we already do for
Bionic, in order to avoid broken installations. Switch our
conditionals from release name comparisons to version numbers in
order to more cleanly support ranges. Also make sure the borg run
test is triggered by changes to the create-venv role.

Change-Id: I5dd064c37786c47099bf2da66b907facb517c92a
2022-08-10 19:35:10 +00:00

38 lines
1.0 KiB
YAML

- name: Check directory is specified
assert:
that: create_venv_path is defined
# Xenial's default pip will try to pull in packages that
# aren't compatible with 3.5. Cap them
- name: Setup bionic era venv
when: ansible_distribution_version is version('16.04', '==')
pip:
name:
- pip<21
- setuptools<51
state: latest
virtualenv: '{{ create_venv_path }}'
virtualenv_command: '/usr/bin/python3 -m venv'
# Bionic's default pip will try to pull in packages that
# aren't compatible with 3.6. Cap them
- name: Setup bionic era venv
when: ansible_distribution_version is version('18.04', '==')
pip:
name:
- pip<22
- setuptools<60
state: latest
virtualenv: '{{ create_venv_path }}'
virtualenv_command: '/usr/bin/python3 -m venv'
- name: Setup later era venv
when: ansible_distribution_version is version('20.04', '>=')
pip:
name:
- pip
- setuptools
state: latest
virtualenv: '{{ create_venv_path }}'
virtualenv_command: '/usr/bin/python3 -m venv'