title: "pause" for every host
body: <p>Before rolling updates I want to set downtime for every host in our monitoring tool. I created a custom module for this. There might be problems when setting downtime which can not be fixed on our end. In that case I want to give the user the choice to decide if the deployment should be aborted or continued without setting downtime.</p>
  
  <p>So let's say I call my module like this:</p>
  
  <pre><code>- downtime:
      duration: 5m
      comment: whatever
    ignore_errors: true
    register: downtime
  </code></pre>
  
  <p>So I'm ignoring the errors to be able to proceed. Otherwise hosts for which setting the downtime failed would not be processed any further.</p>
  
  <p>In the next step I would like the user to manually confirm if he wants to proceed for every host that has no downtime set.</p>
  
  <pre><code>- name: Request user confirmation to proceed in case downtime could not be set
    pause:
      prompt: 'Downtime could not be set for all hosts. Do you want to proceed? Press return to continue. Press Ctrl+c and then "a" to abort'
    when: "{{ downtime | failed }}"
  </code></pre>
  
  <p>Unfortunately the <code>pause</code> module (actually it's an action plugin) would only pause for the first host that was processed. So if the first host failed, it will pause, if the first host passed and all other hosts failed it will simply continue with all hosts.</p>
  
  <p>This seems to be the intended behavior. From the <a href="http://docs.ansible.com/ansible/pause_module.html" rel="nofollow">docs</a>:</p>
  
  <blockquote>
    <p>The pause module integrates into async/parallelized playbooks without any special considerations (see also: Rolling Updates). When using pauses with the <code>serial</code> playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.</p>
  </blockquote>
  
  <p>So no matter how, even if I would use <code>serial: 1</code> (which would not be possible in this case) pause would only stop for the first host.</p>
  
  <p>Right now I simply pause without a condition and let the user decide if he wants to continue or not, no matter if the downtime task failed or not. But since the fails should be very rare this is a manual step I'd like to avoid.</p>
  
  <p>Can anyone see a solution how to either:</p>
  
  <ul>
  <li>pause for <em>every</em> host (that failed)</li>
  <li>pause once, in case <em>any</em> host failed</li>
  </ul>