Ansible Role - Pip
Depending on your operating system, install pip or pipx from the OS package manager or from get-pip. Then install python applications from pip or pipx.
OS | Method | Pip or Pipx |
---|---|---|
centos7 | get-pip | pip |
debian12 | package | pipx |
ubuntu2204 | package | pipx |
sles15sp3 | get-pip | pip |
sles15sp5 | package | pipx |
tumbleweed | package | pipx |
This role is self contained and install pip3 or pipx for debian, ubuntu, opensuse, sles, centos.
However, it assumes that managed node is accessible with ssh and the locales are in UTF8. See docker-debian11 for a example.
From defaults/main.yml:
---
pip_install_package_update: false # In package mode, do you update pip to the latest version.
pip_packages: [] # The python packages (optional).
pip_user: pandemonium # The user who installs the python packages.
pip_extra_args: "--user" # The arguments for pip (when method is get-pip).
From vars/[distro|familly]-[os_familly]-[os_version].yml (depends of distribution):
---
_packages:
- libffi-dev
- python3-dev
- python3-venv
- sudo
_packages_pip:
- python3-pip
- pipx
_pip_executable: pipx
_pip_mandatory_packages: []
_python_executable: python3
None.
---
- name: Converge
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"
CentOS7
This project is licensed under the MIT License - see the LICENSE file for details