chauanhtuandl.pip
Ansible Role: Python PIP package
This role installs the Python PIP package on RHEL, CentOS, Debian, or Ubuntu systems.
Requirements
No special requirements.
Role Variables
Here are the variables you can use, along with their default values (found in defaults/main.yml
):
pip_package
:python-pip
This is the name of the package needed to install
pip
. If you are using Python 3 on Ubuntu, you can set it topython3-pip
.pip_executable
:pip
The role will try to find the correct
pip
executable based on thepip_package
(for instance, it will usepip
for Python 2 andpip3
for Python 3). You can specify this directly, such aspip_executable: pip3.6
.pip_install_packages
:[]
This is a list of packages to install using
pip
. Here are some examples:To specify package names and versions:
pip_install_packages: - name: docker version: "1.2.3" - name: awscli version: "1.11.91"
To install the latest versions:
pip_install_packages: - docker - awscli
To uninstall a package:
pip_install_packages: - name: docker state: absent
To update to the latest version:
pip_install_packages: - name: docker state: latest
To force a reinstall:
pip_install_packages: - name: docker state: forcereinstall
To install in a specific virtual environment:
pip_install_packages: - name: docker virtualenv: /my_app/venv
Dependencies
No dependencies.
Example Playbook
Here is an example of how to use this role in a playbook:
- hosts: all
vars:
pip_install_packages:
- name: docker
- name: awscli
roles:
- chauanhtuan.pip
License
MIT / BSD
Author Information
This role was created in 2017 by Jeff Geerling, who wrote Ansible for DevOps. It was edited in 2019 by Chau Anh Tuan.
ansible-galaxy install chauanhtuandl.pip