pandemonium1986.pip
Ansible Role: Pip
Install pip
or pipx
depending on your operating system, either using the OS package manager or by downloading get-pip
. After that, you can install Python applications using pip
or pipx
.
Installation Methods for Pip/Pipx
OS | Method | Pip or Pipx |
---|---|---|
CentOS 7 | get-pip | pip |
Debian 12 | package | pipx |
Ubuntu 22.04 | package | pipx |
SLES 15 SP3 | get-pip | pip |
SLES 15 SP5 | package | pipx |
Tumbleweed | package | pipx |
Requirements
This role works by installing pip3
or pipx
on Debian, Ubuntu, OpenSUSE, SLES, and CentOS. It requires access to the managed node via SSH and the locale set to UTF8. You can look at the docker-debian11 example for guidance.
Role Variables
Here are some variables used in the role, specified in defaults/main.yml
:
---
pip_install_package_update: false # Should pip be updated to the latest version in package mode.
pip_packages: [] # List of Python packages to install (optional).
pip_user: pandemonium # User who will install the Python packages.
pip_extra_args: "--user" # Additional arguments for pip (used when method is get-pip).
From vars/[distro|family]-[os_family]-[os_version].yml
(varies by distribution):
---
_packages:
- libffi-dev
- python3-dev
- python3-venv
- sudo
_packages_pip:
- python3-pip
- pipx
_pip_executable: pipx
_pip_mandatory_packages: []
_python_executable: python3
Dependencies
This role does not have any dependencies.
Example Playbook
Here’s how to use this role in a playbook:
---
- name: Install Pip and Packages
hosts: all
vars:
pip_user: pandemonium
pip_packages:
- ansible-core
- ansible-lint
- molecule
- molecule-plugins[docker]
tasks:
- name: "Include ansible-role-pip"
include_role:
name: "pandemonium1986.pip"
Disclaimer
- This playbook installs Python3 using the OS package manager. All tasks will be executed with Python3, except for CentOS7.
- The
Pipx
package is not available for CentOS7 and SLES15 SP3.Pip
can be installed usingget-pip
for both of these distributions. After running the playbook, you can installpipx
and then use it to install Python applications.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Author Information
- Michael Maffait - Initial work - Pandemonium1986
Informazioni sul progetto
Install and configure pip, from get-pip.py or pkg manager
Installa
ansible-galaxy install pandemonium1986.pip
Licenza
mit
Download
1.1k
Proprietario
SRE CI/CD and DevOps enthusiast