Add possibility to pass extra arguments to pip command

It is possible to do this in pip module already using: extra_args
https://docs.ansible.com/ansible/latest/modules/pip_module.html#parameter-extra_args

With this change you can define these extra_args within the pip_install_packages item as shown in the README addition coming along with this PR.
This commit is contained in:
Xavier Sanna 2020-03-09 17:30:39 +01:00
parent ca07424814
commit 11033feaa2
2 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,11 @@ A list of packages to install with pip. Examples below:
version: "1.2.3"
- name: awscli
version: "1.11.91"
# Or pass extra arguments to the command
- name: setuptools
extra_args: "--upgrade"
# Or specify bare packages to get the latest release.
- docker
- awscli

View File

@ -7,6 +7,7 @@
- name: Ensure pip_install_packages are installed.
pip:
name: "{{ item.name | default(item) }}"
extra_args: "{{ item.extra_args | default(omit) }}"
version: "{{ item.version | default(omit) }}"
virtualenv: "{{ item.virtualenv | default(omit) }}"
state: "{{ item.state | default(omit) }}"