Actions
Bug #32796
closedEven though a successfully playbook run, the job result is still marked as failed
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:
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