pip

Ansible role pip

install packages with pip

GitHub Downloads Version
github downloads Version

Example Playbook

This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true
  vars:
    pip_packages:
      - "python-dateutil"

  roles:
    - role: "mullholland.pip"

The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: mullholland.repository_epel

  tasks:
    - name: Update apt cache
      ansible.builtin.apt:
        update_cache: true
      when:
        - ansible_os_family == "Debian"

Role Variables

The default values for the variables are set in defaults/main.yml:

---
# By default no modules should be installed. Note: This does not work on Debian Bookworm.
# See https://peps.python.org/pep-0668/

# WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour
# with the system package manager. It is recommended to use a virtual environment
# instead: https://pip.pypa.io/warnings/venv
# For example the variables `python_pip_venvs` down below
# Define pip packages
pip_packages: []
#  - "python-dateutil"
#  - "python-dateutil==0.11"
#  - "python-dateutil>=1.1,<=2.1"
#  - "python-dateutil>=1"
pip_packages_group: []
pip_packages_host: []

# Update pip using pip before installing packages
pip_update: true

# You can use something other than the default pip binary.
# python_pip_executable: pip3

Requirements

State of used roles

The following roles are used to prepare a system. You can prepare your system in another way.

Requirement GitHub GitLab
mullholland.repository_epel Build Status GitHub Build Status GitLab

Context

This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.

Here is an overview of related roles: dependencies

Compatibility

This role has been tested on these container images:

container tags
EL all
Amazon Candidate
Fedora all
Ubuntu all
Debian all

The minimum version of Ansible required is 2.10, tests have been done to:

  • The previous version.
  • The current version.
  • The development version.

If you find issues, please register them in GitHub.

License

MIT.

Author Information

Mullholland

About

install packages with pip

Install
ansible-galaxy install mullholland/ansible-role-pip
GitHub repository
License
apache-2.0
Downloads
2458