Allow the role to only configure pip, not install it

There are times when you may wish to just configure pip,
not install it. This adds a flag to enable that option.

Change-Id: Ibaa3c0b6b323f22dbd640562362106166bbc0a0a
This commit is contained in:
Jesse Pretorius 2018-08-01 15:46:04 +01:00
parent 889b1248ea
commit 79e3480a68
3 changed files with 26 additions and 22 deletions

View File

@ -57,6 +57,12 @@ cache_timeout: 600
# is intercepting the certificates. # is intercepting the certificates.
pip_validate_certs: "yes" pip_validate_certs: "yes"
# Boolean variable to set whether the role should
# install pip if it is found to be missing. There
# are times when you may just want to only configure
# pip, instead of also installing it.
pip_install: true
# Boolean variable to set whether pip.conf should be # Boolean variable to set whether pip.conf should be
# implemented to adjust pip's default behaviour. # implemented to adjust pip's default behaviour.
# By default we do this, but sometimes we want to # By default we do this, but sometimes we want to

View File

@ -21,3 +21,20 @@
until: install_packages is success until: install_packages is success
retries: 5 retries: 5
delay: 2 delay: 2
- name: Determine PIP installation script
shell: >
if [[ $(set -o pipefail; pip --version 2>/dev/null | awk '{print $2}' | cut -d. -f1) -ge 7 ]]; then
echo "$(which pip) install --upgrade"
else
echo "python /opt/get-pip.py"
fi
args:
executable: /bin/bash
register: pip_install_script
changed_when: False
- include_tasks: "install_{{ pip_offline_install | ternary('offline', 'online') }}.yml"
when: pip_install_script.find('get-pip.py') != -1 # skip get-pip.py if a suitable pip is installed
- include_tasks: install_source.yml

View File

@ -30,27 +30,8 @@
tags: tags:
- pip_install-config - pip_install-config
- include_tasks: pre_install.yml - include_tasks: install.yml
tags: when:
- pip_install-install - pip_install | bool
- name: Determine PIP installation script
shell: >
if [[ $(set -o pipefail; pip --version 2>/dev/null | awk '{print $2}' | cut -d. -f1) -ge 7 ]]; then
echo "$(which pip) install --upgrade"
else
echo "python /opt/get-pip.py"
fi
args:
executable: /bin/bash
register: pip_install_script
changed_when: False
- include_tasks: "install_{{ pip_offline_install | ternary('offline', 'online') }}.yml"
tags:
- pip_install-install
when: pip_install_script.stdout.find('get-pip.py') != -1 # skip get-pip.py if a suitable pip is installed
- include_tasks: install_source.yml
tags: tags:
- pip_install-install - pip_install-install