Ansible role to python packages using pipx on debian-based systems. https://ednz.fr
Go to file
Bertrand Lanson dbe0605b11
All checks were successful
test / Linting (push) Successful in 7s
test / Molecule tests (default, debian12) (push) Successful in 1m31s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m13s
test / Molecule tests (with_custom_packages, debian12) (push) Successful in 1m17s
test / Molecule tests (with_custom_packages, ubuntu2204) (push) Successful in 1m18s
feat(core): change namespace
2024-02-05 22:36:42 +01:00
.gitea/workflows remove support for older distros, add wrning about it 2023-08-25 00:21:02 +02:00
.github/workflows feat(core): change namespace 2024-02-05 22:36:42 +01:00
defaults tests should pass now 2023-08-24 23:23:51 +02:00
files Initial commit 2023-08-22 21:19:33 +00:00
handlers Initial commit 2023-08-22 21:19:33 +00:00
meta feat(core): change namespace 2024-02-05 22:36:42 +01:00
molecule feat(core): change namespace 2024-02-05 22:36:42 +01:00
tasks feat(core): change namespace 2024-02-05 22:36:42 +01:00
templates Initial commit 2023-08-22 21:19:33 +00:00
vars remove support for older distros, add wrning about it 2023-08-25 00:21:02 +02:00
.ansible-lint Initial commit 2023-08-22 21:19:33 +00:00
.gitignore Initial commit 2023-08-22 21:19:33 +00:00
.yamllint Initial commit 2023-08-22 21:19:33 +00:00
LICENSE Initial commit 2023-08-22 21:19:33 +00:00
README.md feat(core): change namespace 2024-02-05 22:36:42 +01:00

manage_pipx_packages

This role enables you to manage python packages using pipx, to comply with the PEP668 on debian-based distributions. It can be used on its own , or be called by other roles the install/remove packages on demand.

Warning

This role only supports ubuntu versions starting at 22.04, and debian versions starting a Debian 12. This is due to the pipx package being to out-of-date, or completely absent on older distributions. However, these older distributions typically do not enforce the PEP668, so you can use ednz_cloud.manage_pip_packages instead.

Requirements

None.

Role Variables

Available variables are listed below, along with default values. A sample file for the default values is available in default/manage_pipx_packages.yml.sample in case you need it for any group_vars or host_vars configuration.

manage_pipx_packages_install_prereqs: true # by default, set to true

This variable defines if the prerequisites for the role should be installed. This should be left to true, unless you install python and pipx from another role prior to running this one.

manage_pipx_packages_home: "/opt/pipx" # by default, set to /opt/pipx

This variable define where the pipx packages should be installed. By default, this is a generic path, in order to not tie the installs to a specific user.

manage_pipx_packages_path: "/usr/local/bin" # by default, set to /usr/local/bin

This variable defines the path on which to make the package available. Please note that the actual installation will be done on the manage_pipx_packages_home path. The path given here will be simlinked to the installed package.

manage_pipx_packages_list: # by default, set to install ansible-core
  - name: ansible-core
    version_constraint: latest
    state: present

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).

Warning

Currently, and due to limitations in the ansible pipx module, adding version contraints other that latest will break idempotence of this role. This is not breaking your installation of the package, only the task will always be marked as changed on your playbook run. This will be fixed whenever the pipx module is fixed.

Dependencies

None.

Example Playbook

# calling the role inside a playbook with either the default or group_vars/host_vars
- hosts: servers
  roles:
    - ednz_cloud.manage_pipx_packages

License

MIT / BSD

Author Information

This role was created by Bertrand Lanson in 2023.