buluma.python_pip
Ansible Role python_pip
This role installs Python's pip package manager on your system.
GitHub | Version | Issues | Pull Requests | Downloads |
---|---|---|---|---|
Example Playbook
Here is a simple example playbook that tests the installation in various stages.
---
- name: Converge
hosts: all
become: true
gather_facts: true
pre_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'
changed_when: false
- name: Check if python3.11 EXTERNALLY-MANAGED file exists
ansible.builtin.stat:
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
register: externally_managed_file_py311
- name: Rename python3.11 EXTERNALLY-MANAGED file if it exists
ansible.builtin.command:
cmd: mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED.old
when: externally_managed_file_py311.stat.exists
args:
creates: /usr/lib/python3.11/EXTERNALLY-MANAGED.old
- name: Check if python3.12 EXTERNALLY-MANAGED file exists
ansible.builtin.stat:
path: /usr/lib/python3.12/EXTERNALLY-MANAGED
register: externally_managed_file_py312
- name: Rename python3.12 EXTERNALLY-MANAGED file if it exists
ansible.builtin.command:
cmd: mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.old
when: externally_managed_file_py312.stat.exists
args:
creates: /usr/lib/python3.12/EXTERNALLY-MANAGED.old
roles:
- role: buluma.python_pip
To prepare your machine for this playbook, you can use the following setup:
---
- name: Prepare
hosts: all
become: true
gather_facts: false
roles:
- role: buluma.bootstrap
- role: buluma.epel
- role: buluma.buildtools
For more details, check this full explanation and example.
Role Variables
Default variable values are set in defaults/main.yml
:
---
# defaults file for python_pip
# No modules should be installed by default.
python_pip_modules: []
# You can connect to a proxy by setting this variable.
# python_pip_proxy: "https://user:password@proxy:8443/artifactory/pypi/pypi-virtual/simple"
# Trust foreign pip repositories if you're using them.
# python_pip_trusted_host: my-pip-repository.example.com
# This role can update pip to the latest version.
python_pip_update: true
# You can specify a different pip binary if needed.
# python_pip_executable: pip3
Requirements
- The required pip packages are listed in requirements.txt.
State of Used Roles
Here are the roles utilized for preparing the system. You can set up your system differently if preferred.
Requirement | GitHub | Version |
---|---|---|
buluma.bootstrap | ||
buluma.buildtools | ||
buluma.epel |
Context
This role is connected with various other roles. You can find more details in the documentation for these roles.
Overview of Related Roles
Compatibility
This role works well with the following container images:
Container | Tags |
---|---|
Alpine | all |
Debian | all |
EL | 9, 8 |
Fedora | 39, 38, 40 |
opensuse | all |
Ubuntu | focal, bionic, jammy, lunar, noble |
To use this role, you will need at least Ansible version 2.12. Testing has been conducted on:
- Previous version.
- Current version.
- Development version.
If you encounter any issues, please report them on GitHub.
Changelog
View the Role History.
License
This role is licensed under Apache-2.0.
Author Information
Author: Shadow Walker
Install pythons pip on your system.
ansible-galaxy install buluma.python_pip