--- - name: 'Run test cases: {{ tox_command_line }}' become: true become_user: stack shell: cmd: | sudo su -l stack -c "cd '{{ test_dir }}' && {{ tox_command_line }}" 2>&1 rc=$? echo "*** FINISHED ***" exit $rc register: run_tox ignore_errors: true - name: Show test cases output debug: var=run_tox.stdout_lines failed_when: run_tox is failed