Abort execution of remaining task if certain condition is failed
I want to abort execution of remaining task if certain condition is failed. and display proper error message. So instead of skipping remaining task I want to show error message and stop execution of ansible playbook. Lets say I am running below command $ ansible-playbook playbook.yml -e "param1=value1 param2=value" My playbook look like this:- playbook.yml:- --- - hosts: local user: roop gather_facts: no vars: {param1: "", param2: ""} tasks: #check whether param1 defined - name: 'Check for valid param1' shell: echo {{ param1 }} register: isValidParam1 when: param1 !="" #check if param1 is null