title: How to retry Ansible task that may fail?
body: <p>In my Ansible play I am restarting database then trying to do some operations on it. Restart command returns as soon as restart is started, not when db is up. Next command tries to connect to the database. That command my fail when db is not up.</p>
  <p>I want to retry my second command a few times. If last retry fails, I want to fail my play.</p>
  <p>When I do retries as follows</p>
  <pre class="lang-yaml prettyprint-override"><code>retries: 3
  delay: 5
  </code></pre>
  <p>Then retries are not executed at all, because first command execution fails whole play. I could add  <code>ignore_errors: yes</code> but that way play will pass even if all retries failed. Is there a easy way to retry failures until I have success, but fail when no success from last retry?</p>