I am running a complex playbook using shell in one of my Ansible playbook task. And I am running an upgrade for s/w using command module in one of my Ansible playbook tasks.
How do I terminate execution of rest of the playbook in case output of this command includes failed?
Currently its silently failing and rest of the playbook executing without alerting any failure.
Below is a part of main playbook which has multiple other tasks:
- hosts: abc
tasks:
- name: Upgrade S/W
include_role:
name: sw.upgrade
register: upgrade_result
tags:
- upgrade
- debug:
msg: "{{upgrade_result}}"
and below is task from role:
- name: Execute upgrade
command: "running some upgrade command here"
async: 7200
poll: 10
register: sw_upgrade_hosts
I am new to Ansible and tried failed_when option but that doesn't give expected result.