Look for python3 by default
This patch improves the required package installing task - search first for a py3 and verify a virtualenv package is installed too. If no py3, check py2 and py2 virtualenv respectively. Change-Id: I7abc59f2edb0c4409ea67ac4b611a95779bef714
This commit is contained in:
parent
3a7b72ba93
commit
3d592d6a8b
@ -1,42 +1,44 @@
|
||||
---
|
||||
- name: Is python available
|
||||
command: "python --version"
|
||||
- name: Is python3 available
|
||||
command: "python3 --version"
|
||||
ignore_errors: true
|
||||
register: python_is_available
|
||||
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
|
||||
become: true
|
||||
package:
|
||||
name: python-virtualenv
|
||||
when: python_is_available.rc == 0
|
||||
|
||||
- name: Install virtualenv
|
||||
- name: Install virtualenv (py3)
|
||||
become: true
|
||||
package:
|
||||
name: python3-virtualenv
|
||||
when: python_is_available.rc != 0
|
||||
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
|
||||
changed_when: false
|
||||
|
||||
- name: Check if pip3 is already installed
|
||||
command: "pip3 --version"
|
||||
ignore_errors: true
|
||||
register: pip3_is_installed
|
||||
changed_when: false
|
||||
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
|
||||
- pip3_is_installed.rc != 0
|
||||
block:
|
||||
- name: download get-pip.py
|
||||
get_url: url=https://bootstrap.pypa.io/get-pip.py dest=/tmp
|
||||
|
@ -30,5 +30,5 @@
|
||||
- name: Check if we passed refstack tests
|
||||
fail:
|
||||
msg: "Refstack tests failed."
|
||||
# the refstack_result var got set in run_refstack_client.yaml
|
||||
# the refstack_result var got set in run-refstack-client.yaml
|
||||
when: refstack_result.rc > 0
|
||||
|
@ -46,5 +46,8 @@
|
||||
chdir: "{{ refstack_client_source }}"
|
||||
executable: /bin/bash
|
||||
register: refstack_result
|
||||
# don't fail here in order to allow post_tasks be executed,
|
||||
# the refstack_result is inspected in the last task of the role where it
|
||||
# fails if it failed here
|
||||
ignore_errors: true
|
||||
when: test_list is not defined
|
||||
|
Loading…
Reference in New Issue
Block a user