title: Abort execution of remaining task if certain condition is failed
body: <p>I want to abort execution of remaining task if certain condition is failed.
  and display proper error message.</p>
  
  <p>So instead of skipping remaining task I want to show error message and stop execution of ansible playbook. </p>
  
  <p>Lets say I am running below command</p>
  
  <pre><code>$ ansible-playbook playbook.yml -e "param1=value1 param2=value"
  </code></pre>
  
  <p>My playbook look like this:-</p>
  
  <p><strong>playbook.yml:-</strong></p>
  
  <pre><code>---
      - 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 or invalid  
          - name: 'check if param1 is null or invalid' 
            debug: msg="Please enter correct param1"
            when: param1 == ""
  
          #check whether param2 defined
          - name: 'Check for valid param2'
            shell: echo {{ param2 }}
            register: isValidParam2
            when: param2 != ""
  
          #check if param2 is null or invalid  
          - name: 'check if param2 is null or invalid' 
            debug: msg="Please enter correct param2"
            when: param2 == ""  
  
  
          #check params is valid and defined
          - name: 'Check for valid params'
            shell: echo "param1={{ param1 }} param2={{ param2 }}
            register: validParams
            when: isValidParam1 is defined and isValidParam2 is defined
  
          #check if params are invalid then abort below all tasks.  
          - name: 'check if validParams is null or invalid' 
            debug: msg="Please enter correct Params"
            when: validParams is not defined    
  
  
           # based on validParams, and different value of param1 more than 
            10 task executing.
  </code></pre>
  
  <p>As I have mentioned in my last task comment. I am executing more than 10 task based on <code>validParams</code> and <code>param1</code> different value. What I need here 
  if <code>validParams</code> is undefined then abort all execution and show error messages.</p>
  
  <p>Is there any efficient way to do this . Please suggest me. </p>