pip
Ansible role pip
Install Pip (Python package manager) for Linux.
GitHub | Version | Issues | Pull Requests | Downloads |
---|---|---|---|---|
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
vars:
pip_install_packages:
# Test installing a specific version of a package.
- name: ipaddress
version: "1.0.18"
# Test installing a package by name.
- colorama
pre_tasks:
- name: update apt cache.
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
- name: set package name for older OSes.
set_fact:
pip_package: python-pip
when: >
(ansible_os_family == 'RedHat') and (ansible_distribution_major_version | int < 8)
or (ansible_distribution == 'Debian') and (ansible_distribution_major_version | int < 10)
or (ansible_distribution == 'Ubuntu') and (ansible_distribution_major_version | int < 18)
roles:
- role: buluma.pip
The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml
:
---
- name: Prepare
hosts: all
become: true
# become_method: su
gather_facts: false
vars:
ansible_python_interpreter: /usr/bin/python3
roles:
- role: buluma.bootstrap
Also see a full explanation and example on how to use these roles.
Role Variables
The default values for the variables are set in defaults/main.yml
:
---
# For Python 3, use python3-pip.
pip_package: python3-pip
pip_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}"
pip_install_packages: []
Requirements
- pip packages listed in requirements.txt.
State of used roles
The following roles are used to prepare a system. You can prepare your system in another way.
Requirement | GitHub | Version |
---|---|---|
buluma.bootstrap | ||
buluma.setuptools | ||
buluma.openssl | ||
buluma.ca_certificates |
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:
Compatibility
This role has been tested on these container images:
container | tags |
---|---|
Fedora | 39, 38, 40 |
Debian | all |
Ubuntu | focal, bionic, jammy, noble, lunar |
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