Project

General

Profile

Actions

Bug #32796

closed

Even though a successfully playbook run, the job result is still marked as failed

Added by Hao Yu about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-

Description

Cloned from bugzilla 1971395

When using a playbook with blocks to handle errors, it's run successfully but the job is marked as failed.

Playbook:
~~~
- hosts: all
gather_facts: false
tasks:
- name: Handle the error
block:
- name: Print a message
ansible.builtin.debug:
msg: 'I execute normally'

- name: Force a failure
ansible.builtin.command: /bin/false
ignore_errors: yes
- name: Never print this
ansible.builtin.debug:
msg: 'I never execute, due to the above task failing, :-('
rescue:
- name: Print when errors
ansible.builtin.debug:
msg: 'I caught an error, can do stuff here to fix it, :-)'
~~~
Actions

Also available in: Atom PDF