tobiko/roles/tobiko-ensure-tox/tasks/tox.yaml

42 lines
1002 B
YAML

---
- name: "ensure Tox is installed"
command: |
'{{ python_executable }}' -m pip install --user 'tox>={{ tox_min_version }}'
register: install_tox
changed_when: "'Successfully installed' in install_tox.stdout"
- block:
- name: "get '{{ tox_command }}' full path"
shell: |
export PATH={{ python_exe_path }}
which '{{ tox_command }}'
register: get_tox_path
- name: "set tox_executable fact"
set_fact:
tox_executable: '{{ get_tox_path.stdout_lines | first }}'
rescue:
- name: "set tox_executable fact"
set_fact:
tox_executable: '{{ ansible_user_dir }}/.local/bin/tox'
- name: "get installed Tox version"
command: "'{{ tox_executable }}' --version"
register: get_tox_version
- name: "update tox_version fact"
set_fact:
tox_version: '{{ get_tox_version.stdout_lines | first }}'
- name: "show Tox facts"
debug:
msg:
tox_executable: '{{ tox_executable }}'
tox_version: '{{ tox_version }}'