From 60c03519cd26a2026ef1cf7e569fd0bf13412831 Mon Sep 17 00:00:00 2001 From: Sergei Petrosian Date: Fri, 12 Apr 2024 17:40:31 +0200 Subject: [PATCH] Fail if in a rescue block --- tests/tasks/assert_fail_on_s390x.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tasks/assert_fail_on_s390x.yml b/tests/tasks/assert_fail_on_s390x.yml index 591c858..79ab203 100644 --- a/tests/tasks/assert_fail_on_s390x.yml +++ b/tests/tasks/assert_fail_on_s390x.yml @@ -11,3 +11,10 @@ - name: End execution on s390x host to avoid failures in clean up meta: end_host + +# When this task file is included in a rescue block, and the above task is +# skipped, Ansible would report success considering that a failure was rescued +- name: Fail if in a rescue block + when: ansible_failed_result is defined + fail: + msg: "{{ ansible_failed_result }}"