Add role to ensure tox is installed on target host

Change-Id: I8d2ee07bc84efb7eb0eb23a64ecdff97fd5cecb6
This commit is contained in:
Federico Ressi 2020-03-24 12:01:13 +01:00
parent 10c1eda1fc
commit 5c1edfac76
5 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,4 @@
---
tox_executable: tox
tox_min_version: 3.4

View File

@ -0,0 +1,5 @@
---
dependencies:
- role: tobiko-common
- role: tobiko-ensure-python

View File

@ -0,0 +1,23 @@
---
- name: "ensure Tox is installed"
command: |
'{{ python_executable }}' -m pip install --user 'tox>={{ tox_min_version }}'
register: result
changed_when: "'Successfully installed' in result.stdout"
- name: "set tox_executable fact"
set_fact:
tox_executable: "{{ ansible_user_dir }}/.local/bin/tox"
cacheable: true
when: result is changed
- name: "get installed Tox version"
command: "{{ tox_executable }} --version"
register: get_installed_tox_version
- name: "show Tox installed version"
debug: var=get_installed_tox_version.stdout_lines

View File

@ -2,7 +2,7 @@
# Directory where test cases has been deployed to
tox_dir: '{{ test_dir | realpath }}'
tox_command: tox
tox_command: '{{ tox_executable | default(tox) }}'
tox_environment: {}
tox_envlist:
tox_extra_args: ''

View File

@ -3,3 +3,4 @@
dependencies:
- role: tobiko-common
- role: tobiko-ensure-python
- role: tobiko-ensure-tox