Ansible Role - Pip (for Python)
Go to file
Jeff Geerling 5b1f472d72
Merge pull request #69 from ShaneMcC/issue-66
Fix for externally-managed python on later ubuntu/debian installs.
2024-11-10 21:05:11 -06:00
.github Fixup CI versions. Drop all older RHEL releases which are broken. 2024-07-16 14:23:21 -05:00
defaults PR #30 follow-up: Default to python3-pip. 2020-07-22 12:01:53 -05:00
meta Remove official support for RHEL. Rocky/Alma/Stream support is best-effort. 2023-06-23 10:57:26 -05:00
molecule/default Fixup CI versions. Drop all older RHEL releases which are broken. 2024-07-16 14:23:21 -05:00
tasks Fix for externally-managed python on later ubuntu/debian installs. 2024-11-11 02:55:14 +00:00
.ansible-lint Make ansible-lint work again. 2021-02-22 16:16:26 -06:00
.gitignore Make ansible-lint work again. 2021-02-22 16:16:26 -06:00
.yamllint Stale bot is now Stale GitHub Action. 2023-07-10 17:48:41 -05:00
LICENSE Initial commit. 2017-05-26 23:09:47 -04:00
README.md Update README.md to fix single-letter typo 2023-11-27 17:24:07 -08:00

Ansible Role: Pip (for Python)

CI

An Ansible Role that installs Pip on Linux.

Requirements

On RedHat/CentOS, you may need to have EPEL installed before running this role. You can use the geerlingguy.repo-epel role if you need a simple way to ensure it's installed.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

pip_package: python3-pip

The name of the package to install to get pip on the system. For older systems that don't have Python 3 available, you can set this to python-pip.

pip_executable: pip3

The role will try to autodetect the pip executable based on the pip_package (e.g. pip for Python 2 and pip3 for Python 3). You can also override this explicitly, e.g. pip_executable: pip3.6.

pip_install_packages: []

A list of packages to install with pip. Examples below:

pip_install_packages:
  # Specify names and versions.
  - name: docker
    version: "1.2.3"
  - name: awscli
    version: "1.11.91"

  # Or specify bare packages to get the latest release.
  - docker
  - awscli

  # Or uninstall a package.
  - name: docker
    state: absent

  # Or update a package to the latest version.
  - name: docker
    state: latest

  # Or force a reinstall.
  - name: docker
    state: forcereinstall

  # Or install a package in a particular virtualenv.
  - name: docker
    virtualenv: /my_app/venv

  # Or pass through any extra arguments.
  - name: my_special_package_from_my_special_repo
    extra_args: --extra-index-url https://my-domain/pypi/pypi-master/simple

Dependencies

None.

Example Playbook

- hosts: all

  vars:
    pip_install_packages:
      - name: docker
      - name: awscli

  roles:
    - geerlingguy.pip

License

MIT / BSD

Author Information

This role was created in 2017 by Jeff Geerling, author of Ansible for DevOps.