If you are not familiar with modules, check out Ansible - Getting Started with Modules.
The pip module can be used to use pip to do something, such as installing a Python package.
pip will need to be installed on your managed nodes. The yum module can be used to install pip on your managed nodes.
In this example, pip will be used to install the latest version of pymysql.
- name: pip install the latest version of pymysql
pip:
name: pymysql
state: latest
Or to install a specific version of pymysql.
- name: pip install pymysql version 0.10.1
pip:
name: pymysql=0.10.1
To install two (or more) packages.
- name: pip install the latest versions of pymysql and django
pip:
name:
- pymysql
- django
state: latest
To uninstall pymysql.
- name: pip uninstall pymysql
pip:
name: pymysql
state: absent