ansible / ansible.builtin / v2.4.0.0-1 / module / pip Manages Python library dependencies. | "added in version" 0.7 of ansible.builtin" Authors: Matt Wright (@mattupstate) preview | supported by coreansible.builtin.pip (v2.4.0.0-1) — module
pip
Install with pip install ansible==2.4.0.0.post1
Manage Python library dependencies. To use this module, one of the following keys is required: C(name) or C(requirements).
# 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 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: 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 (Bottle) within a user home directory. - pip: name: bottle extra_args: --user
# 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
# Install (Bottle), forcing reinstallation if it's already installed - pip: name: bottle state: forcereinstall
# Install (Bottle) while ensuring the umask is 0022 (to ensure other users can use it) - pip: name: bottle umask: 0022 become: True
name: default: null description: - 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. required: false chdir: default: null description: - cd into this directory before running the command required: false version_added: '1.3' version_added_collection: ansible.builtin state: choices: - present - absent - latest - forcereinstall default: present description: - The state of module - The 'forcereinstall' option is only available in Ansible 2.1 and above. required: false umask: default: null description: - 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). required: false version_added: '2.1' version_added_collection: ansible.builtin version: default: null description: - The version number to install of the Python library specified in the I(name) parameter required: false editable: default: false description: - Pass the editable flag. required: false version_added: '2.0' version_added_collection: ansible.builtin executable: default: null description: - 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 C(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. required: false version_added: '1.3' version_added_collection: ansible.builtin extra_args: default: null description: - Extra arguments passed to pip. required: false version_added: '1.0' version_added_collection: ansible.builtin virtualenv: default: null description: - An optional path to a I(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. required: false requirements: default: null description: - 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. required: false virtualenv_python: default: null description: - The Python executable used for creating the virtual environment. For example C(python3.5), C(python2.7). When not specified, the Python version used to run the ansible module is used. This parameter should not be used when C(virtualenv_command) is using C(pyvenv) or the C(-m venv) module. required: false version_added: '2.0' version_added_collection: ansible.builtin virtualenv_command: default: virtualenv description: - The command or a pathname to the command to create the virtual environment with. For example C(pyvenv), C(virtualenv), C(virtualenv2), C(~/bin/virtualenv), C(/usr/local/bin/virtualenv). required: false version_added: '1.1' version_added_collection: ansible.builtin virtualenv_site_packages: choices: - 'yes' - 'no' default: 'no' description: - 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. required: false version_added: '1.0' version_added_collection: ansible.builtin