Ansible role to manage python package with pip on debian-based systems. https://ednz.fr
Go to file
2023-04-06 21:21:22 +02:00
.github/workflows renamed pip install task to avoid confusion with apt install task, 1st publish 2023-03-16 23:36:23 +01:00
defaults remove top comment to sample file 2023-03-20 22:52:18 +01:00
handlers added skeleton 2023-03-14 23:23:33 +01:00
meta improvements, not tested yet, not published 2023-03-15 22:32:18 +01:00
molecule tests should cover most ofthe usecases now 2023-03-16 22:57:55 +01:00
tasks moved package declaration to variable or installing python and pip 2023-04-06 21:21:22 +02:00
vars moved package declaration to variable or installing python and pip 2023-04-06 21:21:22 +02:00
.ansible-lint added skeleton 2023-03-14 23:23:33 +01:00
.gitignore housekeeping and typos 2023-04-04 21:33:40 +02:00
.gitlab-ci.yml will it pass ? 2023-03-16 23:06:20 +01:00
.yamllint added skeleton 2023-03-14 23:23:33 +01:00
LICENSE added skeleton 2023-03-14 23:23:33 +01:00
README.md housekeeping and typos 2023-04-04 21:33:40 +02:00

Manage pip packages

This repository is only a mirror. Development and testing is done on a private gitlab server.

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

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_pip_packages.yml.sample in case you need it for any group_vars or host_vars configuration.

manage_pip_packages_install_prereqs: true # by default, set to true
manage_apt_packages_list: # by default, not defined
  - name: nginx
    version_constraint: latest # Leaving empty or setting '' will be considered as latest
    state: absent
  - name: ...

This variable is a list of packages, with their name, desired version and state. version_constraint can be multiple constraints,separatedby commas (example: >1.10, >1.10,<1.15,!=1.12,==1.13).

Dependencies

This role requires ednxzu.manage_apt_packages to install python3 and pip. If you already installed python and pip, you can skip dependencies by setting manage_pip_packages_install_prereqs to false.

Example Playbook

# calling the role inside a playbook with either the default or group_vars/host_vars
- hosts: servers
  roles:
    - ednxzu.manage_pip_packages
# calling the role inside a playbook and injecting variables (in another role for example)
- hosts: servers
  tasks:
    - name: "Install ansible with pip"
      ansible.builtin.include_role:
        name: ednxzu.manage_pip_packages
      vars:
        manage_pip_packages_install_prereqs: false
        manage_pip_packages_list:
          - name: ansible-core
            version_constraint: latest
            state: present

License

MIT / BSD

Author Information

This role was created by Bertrand Lanson in 2023.