title: How can I break the with_items loop based on a condition
body: <p>I want to break out of the with_items loop based on a condition. That condition for arguments sake is if the stdout of a command is equal to a particular string.</p>
  
  <p>Obviously the example below does not work but this is an idea of what I want to do.</p>
  
  <p>For example:</p>
  
  <pre><code>- name: testing loop
    shell: "echo {{ item }}"
    with_items:
       - "one"
       - "two"
       - "three"
    register: shell_command # registering the shell command and it's attributes
    when: shell_command.stdout == "two" # break once the stdout of the run shell command matches the string "two". So it will run twice and break on the second.
  </code></pre>