From 45a3790d85fa21d8afb464b7f5e53dff5e3156f8 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 4 Feb 2020 20:41:08 +0100 Subject: [PATCH] ensure-tox: save tox_executable fact If we install our own local version of tox, we should set a fact with the tox_executable so other tasks can leverage it. Change-Id: If6895bbb898261e88c0e3083d21210209f79995f --- roles/ensure-tox/defaults/main.yml | 1 + roles/ensure-tox/tasks/main.yaml | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 roles/ensure-tox/defaults/main.yml diff --git a/roles/ensure-tox/defaults/main.yml b/roles/ensure-tox/defaults/main.yml new file mode 100644 index 000000000..35e4a9af6 --- /dev/null +++ b/roles/ensure-tox/defaults/main.yml @@ -0,0 +1 @@ +tox_executable: tox \ No newline at end of file diff --git a/roles/ensure-tox/tasks/main.yaml b/roles/ensure-tox/tasks/main.yaml index 03ec536fa..55cd0b585 100644 --- a/roles/ensure-tox/tasks/main.yaml +++ b/roles/ensure-tox/tasks/main.yaml @@ -14,5 +14,11 @@ 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: Output tox version - command: tox --version + command: "{{ tox_executable }} --version"