HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What do skipped, rescued, and ignored results mean in ANSIBLE playbook execution?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
skippedignoredwhatrescuedmeanplaybookandresultsansibleexecution

Problem

What do skipped, rescued, and ignored results mean in an Ansible playbook execution?
What would be a possible scenario where these results would be different from 0?
PLAY RECAP ***
localhost: ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Solution

For example, the play below
- hosts: localhost
tasks:

- name: Task will be SKIPPED
debug:
msg: You will never see this message.
when: false

- name: Failed command will be IGNORED
command: /usr/bin/false
ignore_errors: true

- name: Failed command will be RESCUED
block:
- command: /usr/bin/false
rescue:
- debug:
msg: "{{ ansible_failed_result }}"


gives
PLAY RECAP ***
localhost: ok=2 changed=1 unreachable=0 failed=0 skipped=1 rescued=1 ignored=1


For details see

  • Error handling in playbooks



  • Handling errors with blocks



Briefly, an error is ignored when you set ignore_errors: true. This can be set on multiple levels. See Playbook Keywords. If you use block/rescue you can actively handle the consequences of the error.

Context

StackExchange DevOps Q#14542, answer score: 4

Revisions (0)

No revisions yet.