- name: Install pip include_role: name: ensure-pip - name: Check if nox is installed shell: | command -v {{ nox_executable }} {{ nox_venv_path }}/bin/nox || exit 1 args: executable: /bin/bash register: nox_preinstalled failed_when: false - name: Export preinstalled nox_exectuable set_fact: nox_executable: '{{ nox_preinstalled.stdout_lines[0] }}' cacheable: true when: nox_preinstalled.rc == 0 - name: Install nox to local env when: nox_preinstalled.rc != 0 block: - name: Create local venv command: '{{ ensure_pip_virtualenv_command }} {{ nox_venv_path }}' - name: Install nox to local venv command: '{{ nox_venv_path }}/bin/pip install nox{{ ensure_nox_version }}' - name: Export installed nox_executable path set_fact: nox_executable: '{{ nox_venv_path }}/bin/nox' cacheable: true - name: Output nox version command: "{{ nox_executable }} --version"