create-venv: add role; use in install-borg
As noted inline, make a create-venv role that brings in appropriate versions on Bionic. This was noticed because pip is trying to install borgbackup with setuptools_scm 7.0.5, which doesn't support Python 3.6. We use this new role to create the venv correctly. Change-Id: I81fd268a9354685496a75e33a6f038a32b686352
This commit is contained in:
parent
1f7e89dcc8
commit
ea08cdbd16
19
playbooks/roles/create-venv/README.rst
Normal file
19
playbooks/roles/create-venv/README.rst
Normal file
@ -0,0 +1,19 @@
|
||||
Create a venv
|
||||
|
||||
You would think this role is unnecessary and roles could just install
|
||||
a ``venv`` directly ... except sometimes pip/setuptools get out of
|
||||
date on a platform and can't understand how to install compatible
|
||||
things. For example the pip shipped on Bionic will upgrade itself to
|
||||
a version that doesn't support Python 3.6 because it doesn't
|
||||
understand the metadata tags the new version marks itself with. We've
|
||||
seen similar problems with wheels. History has shown that whenever
|
||||
this problem appears solved, another issue will appear. So for
|
||||
reasons like this, we have this as a synchronization point for setting
|
||||
up venvs.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: create_venv_path
|
||||
:default: unset
|
||||
|
||||
Required argument; the directory to make the ``venv``
|
25
playbooks/roles/create-venv/tasks/main.yaml
Normal file
25
playbooks/roles/create-venv/tasks/main.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
- name: Check directory is specified
|
||||
assert:
|
||||
that: create_venv_path is defined
|
||||
|
||||
# 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_release == 'bionic'
|
||||
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_release != 'bionic'
|
||||
pip:
|
||||
name:
|
||||
- pip
|
||||
- setuptools
|
||||
state: latest
|
||||
virtualenv: '{{ create_venv_path }}'
|
||||
virtualenv_command: '/usr/bin/python3 -m venv'
|
@ -17,6 +17,12 @@
|
||||
- fuse
|
||||
- pkg-config
|
||||
|
||||
- name: Create venv
|
||||
include_role:
|
||||
name: create-venv
|
||||
vars:
|
||||
create_venv_path: '/opt/borg'
|
||||
|
||||
- name: Install borg
|
||||
pip:
|
||||
# borg build deps are a little ... interesting, it needs cython
|
||||
@ -25,4 +31,3 @@
|
||||
- cython
|
||||
- 'borgbackup[fuse]=={{ borg_version }}'
|
||||
virtualenv: /opt/borg
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
|
Loading…
Reference in New Issue
Block a user