You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
The explicit executable or a pathname to the executable to be used to run pip for a specific version of Python installed in the system. For example pip-3.3, if there are both Python 2.7 and 3.3 installations in the system and you want to run pip for the Python 3.3 installation. It cannot be specified together with the 'virtualenv' parameter (added in 2.1). By default, it will take the appropriate version for the python interpreter use by ansible, e.g. pip3 on python 3, and pip2 or pip on python 2.
extra_args
no
Extra arguments passed to pip.
name
no
The name of a Python library to install or the url of the remote package.
As of 2.2 you can supply a list of names.
requirements
no
The path to a pip requirements file, which should be local to the remote system. File can be specified as a relative path if using the chdir option.
state
no
present
present
absent
latest
forcereinstall
The state of module
The 'forcereinstall' option is only available in Ansible 2.1 and above.
umask
(added in 2.1)
no
The system umask to apply before installing the pip package. This is useful, for example, when installing on systems that have a very restrictive umask by default (e.g., 0077) and you want to pip install packages which are to be used by all users. Note that this requires you to specify desired umask mode in octal, with a leading 0 (e.g., 0077).
version
no
The version number to install of the Python library specified in the name parameter
virtualenv
no
An optional path to a virtualenv directory to install into. It cannot be specified together with the 'executable' parameter (added in 2.1). If the virtualenv does not exist, it will be created before installing packages. The optional virtualenv_site_packages, virtualenv_command, and virtualenv_python options affect the creation of the virtualenv.
virtualenv_command
no
virtualenv
The command or a pathname to the command to create the virtual environment with. For example pyvenv, virtualenv, virtualenv2, ~/bin/virtualenv, /usr/local/bin/virtualenv.
virtualenv_python
(added in 2.0)
no
The Python executable used for creating the virtual environment. For example python3.5, python2.7. When not specified, the Python version used to run the ansible module is used. This parameter should not be used when virtualenv_command is using pyvenv or the -m venv module.
virtualenv_site_packages
no
no
yes
no
Whether the virtual environment will inherit packages from the global site-packages directory. Note that if this setting is changed on an already existing virtual environment it will not have any effect, the environment must be deleted and newly created.
# Install (Bottle) python package.-pip:name:bottle# Install (Bottle) python package on version 0.11.-pip:name:bottleversion:0.11# Install (MyApp) using one of the remote protocols (bzr+,hg+,git+,svn+). You do not have to supply '-e' option in extra_args.-pip:name:svn+http://myrepo/svn/MyApp#egg=MyApp# Install MyApp using one of the remote protocols (bzr+,hg+,git+).-pip:name:git+http://myrepo/app/MyApp# Install (MyApp) from local tarball-pip:name:file:///path/to/MyApp.tar.gz# Install (Bottle) into the specified (virtualenv), inheriting none of the globally installed modules-pip:name:bottlevirtualenv:/my_app/venv# Install (Bottle) into the specified (virtualenv), inheriting globally installed modules-pip:name:bottlevirtualenv:/my_app/venvvirtualenv_site_packages:yes# Install (Bottle) into the specified (virtualenv), using Python 2.7-pip:name:bottlevirtualenv:/my_app/venvvirtualenv_command:virtualenv-2.7# Install (Bottle) within a user home directory.-pip:name:bottleextra_args:--user# Install specified python requirements.-pip:requirements:/my_app/requirements.txt# Install specified python requirements in indicated (virtualenv).-pip:requirements:/my_app/requirements.txtvirtualenv:/my_app/venv# Install specified python requirements and custom Index URL.-pip:requirements:/my_app/requirements.txtextra_args:-i https://example.com/pypi/simple# Install (Bottle) for Python 3.3 specifically,using the 'pip-3.3' executable.-pip:name:bottleexecutable:pip-3.3# Install (Bottle), forcing reinstallation if it's already installed-pip:name:bottlestate:forcereinstall# Install (Bottle) while ensuring the umask is 0022 (to ensure other users can use it)-pip:name:bottleumask:0022become:True
Please note that virtualenv (http://www.virtualenv.org/) must be installed on the remote host if the virtualenv parameter is specified and the virtualenv needs to be created.
By default, this module will use the appropriate version of pip for the interpreter used by ansible (e.g. pip3 when using python 3, pip2 otherwise)
For more information about Red Hat’s this support of this module, please
refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>