added option to bypass pep668 error
All checks were successful
test / Linting (push) Successful in 33s
test / Molecule tests (default, debian11) (push) Successful in 1m23s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m28s
test / Molecule tests (default, debian12) (push) Successful in 1m41s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m11s
test / Molecule tests (with_custom_packages, debian12) (push) Successful in 49s
test / Molecule tests (with_custom_packages, debian11) (push) Successful in 1m4s
test / Molecule tests (with_custom_packages, ubuntu2004) (push) Successful in 1m17s
test / Molecule tests (with_custom_packages, ubuntu2204) (push) Successful in 1m20s

This commit is contained in:
Bertrand Lanson 2023-08-27 18:13:08 +02:00
parent 613b38a8ff
commit 813279acef
5 changed files with 12 additions and 0 deletions

View File

@ -25,6 +25,14 @@ manage_pip_packages_list: # by default, not defined
``` ```
This variable is a list of packages, with their name, desired version and state. `version_constraint` can be multiple constraints,separated by commas (example: `>1.10`, `>1.10,<1.15,!=1.12`,`==1.13`). This variable is a list of packages, with their name, desired version and state. `version_constraint` can be multiple constraints,separated by commas (example: `>1.10`, `>1.10,<1.15,!=1.12`,`==1.13`).
```yaml
manage_pip_packages_allow_break_system_packages: false # by default, set to false
```
This variable allow you to pass the `--break_system_packages` to pip.
> **Warning**
> This is not recommended, and is only here if you have no other choice to install packages that aren't supported by the package manager, on distros that enforce the [PEP668](https://peps.python.org/pep-0668/). Chances are you can probably use [manage_pipx_packages](https://github.com/ednxzu/manage_pipx_packages) to install packages using pipx, avoiding the potential damages to your system.
Dependencies Dependencies
------------ ------------

View File

@ -5,3 +5,4 @@ manage_pip_packages_list:
- name: pip - name: pip
version_constraint: latest version_constraint: latest
state: present state: present
manage_pip_packages_allow_break_system_packages: false

View File

@ -5,3 +5,4 @@
# - name: pip # - name: pip
# version_constraint: latest # version_constraint: latest
# state: present # state: present
# manage_pip_packages_allow_break_system_packages: false

View File

@ -10,3 +10,4 @@ manage_pip_packages_list:
- name: vault-cli - name: vault-cli
version_constraint: '<3.1.0' version_constraint: '<3.1.0'
state: present state: present
manage_pip_packages_allow_break_system_packages: false

View File

@ -8,6 +8,7 @@
ansible.builtin.pip: ansible.builtin.pip:
name: "{{ item.name }}{% if item.version_constraint not in [None, '', 'latest'] %}{{ item.version_constraint }}{% endif %}" name: "{{ item.name }}{% if item.version_constraint not in [None, '', 'latest'] %}{{ item.version_constraint }}{% endif %}"
state: "{{ item.state }}" state: "{{ item.state }}"
extra_args: "{% if manage_pip_packages_allow_break_system_packages %}--break-system-packages{% endif %}"
loop: "{{ manage_pip_packages_list }}" loop: "{{ manage_pip_packages_list }}"
when: manage_pip_packages_list is defined when: manage_pip_packages_list is defined
and manage_pip_packages_list not in [None, ''] and manage_pip_packages_list not in [None, '']