Author: | Matt Wright |
---|
Manage Python library dependencies. To use this module, one of the following keys is required: name or requirements.
parameter | required | default | choices | comments |
---|---|---|---|---|
chdir | no | cd into this directory before running the command (added in Ansible 1.3) | ||
executable | no | 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. (added in Ansible 1.3) |
||
extra_args | no | Extra arguments passed to pip. (added in Ansible 1.0) | ||
name | no | The name of a Python library to install or the url of the remote package. | ||
requirements | no | The path to a pip requirements file | ||
state | no | present |
|
The state of module |
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 | ||
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_site_packages | no | 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. (added in Ansible 1.0) |
Note
Requires virtualenv
Note
Requires pip
# Install (Bottle) python package.
- pip: name=bottle
# Install (Bottle) python package on version 0.11.
- pip: name=bottle version=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 (Bottle) into the specified (virtualenv), inheriting none of the globally installed modules
- pip: name=bottle virtualenv=/my_app/venv
# Install (Bottle) into the specified (virtualenv), inheriting globally installed modules
- pip: name=bottle virtualenv=/my_app/venv virtualenv_site_packages=yes
# Install (Bottle) into the specified (virtualenv), using Python 2.7
- pip: name=bottle virtualenv=/my_app/venv virtualenv_command=virtualenv-2.7
# Install specified python requirements.
- pip: requirements=/my_app/requirements.txt
# Install specified python requirements in indicated (virtualenv).
- pip: requirements=/my_app/requirements.txt virtualenv=/my_app/venv
# Install specified python requirements and custom Index URL.
- pip: requirements=/my_app/requirements.txt extra_args='-i https://example.com/pypi/simple'
# Install (Bottle) for Python 3.3 specifically,using the 'pip-3.3' executable.
- pip: name=bottle executable=pip-3.3
Note
Please note that virtualenv (http://www.virtualenv.org/) must be installed on the remote host if the virtualenv parameter is specified.