title: How to use Ansible fail modules to print multiple custom messages
body: <p>I want my playbook to fail under two conditions. </p>
  
  <ol>
  <li>If the SQL query's results is not returned by the database</li>
  <li>If the SQL query's result returned has the string "775" </li>
  </ol>
  
  <p>Below Playbook works fine and does the job.</p>
  
  <pre><code>- name: "Play 1"
    hosts: localhost
     - name: "Search for Number"
       command: &gt;
         mysql --user="{{ DBUSER }}" --password="{{ DBPASS }}" deployment
         --host=localhost --batch --skip-column-names
         --execute="SELECT num FROM deploy_tbl"     
       register: command_result 
       failed_when: command_result.stdout is search('775') or command_result.rc != 0
       when: Layer == 'APP'  
  </code></pre>
  
  <p>I now wanted to print custom messages for both the conditions so I added the below lines after the above playbook code. </p>
  
  <pre><code>   - name: Make Sure the mandatory input values are passed 
       fail:
         msg: "This REQ is already Deployed. Hence retry with a Unique Number."
       when: command_result.stdout is search('775')
  
     - name: Make Sure the mandatory input values are passed 
       fail:
         msg: "Database is not reachable."
       when: command_result.rc != 0 
  </code></pre>
  
  <p>This give me syntax error when running the playbook. </p>
  
  <p>I'm on the latest version of Ansible.</p>
  
  <p>Can you please tell me how can we update my plabook to print either of the custom message based on condition check ?</p>