ansible-role-refstack-client/tasks/install-packages.yaml
Lukas Piwowarski 2fd59ac4a4 Update URL for get-pip.py
The minimum supported python version for get-pip.py from
https://bootstrap.pypa.io/get-pip.py is 3.6. When it is run
with python 2.7 it ends with following error:

ERROR: This script does not work on Python 2.7 The minimum
supported Python version is 3.6. Please use
https://bootstrap.pypa.io/pip/2.7/get-pip.py
instead.

This patch updates the URL to make sure the downloaded get-pip.py
supports python 2.7 or 2.6.

Change-Id: Ifb6aa332822bcc1f932d2107ed183b9649d12b1b
2021-07-12 07:44:14 +00:00

61 lines
1.5 KiB
YAML

---
- name: Is python3 available
command: "python3 --version"
ignore_errors: true
register: python3_is_available
changed_when: false
- name: Is python2 available
command: "python2 --version"
ignore_errors: true
changed_when: false
when: python3_is_available.failed
- name: Install git
become: true
package:
name: git
- name: Install virtualenv (py3)
become: true
package:
name: python3-virtualenv
when: not python3_is_available.failed
- name: Install virtualenv (py2)
become: true
package:
name: python-virtualenv
when: python3_is_available.failed
- name: Check if pip is already installed
command: "pip --version"
ignore_errors: true
register: pip_is_installed
when: python3_is_available.failed
# pip3 is a dependency of a python3 package, so if there is a python3
# installed, pip3 should be installed already as well
- when:
- python3_is_available.failed
- pip_is_installed.rc != 0
block:
- name: get python version
command: "python --version"
register: python_version
- name: download get-pip.py
get_url: url=https://bootstrap.pypa.io/pip/2.7/get-pip.py dest=/tmp
when: '"2.7" in python_version.stdout'
- name: download get-pip.py
get_url: url=https://bootstrap.pypa.io/pip/2.6/get-pip.py dest=/tmp
when: '"2.6" in python_version.stdout'
- name: install pip
become: true
command: "python /tmp/get-pip.py"
- name: delete get-pip.py
file: state=absent path=/tmp/get-pip.py