title: While loop and executing commandsds in remote machine
body: <p>I have the following commands which needs to be included in Ansible.</p>
  <p>How can I incorporate these commands in Ansible module?</p>
  <pre><code>while sudo fuser /var/lib/dpkg/lock &gt;/dev/null 2&gt;&amp;1 ; do
      sleep 1
  done
  while sudo fuser /var/lib/apt/lists/lock &gt;/dev/null 2&gt;&amp;1 ; do
      sleep 1
  done
  if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then
    while sudo fuser /var/log/unattended-upgrades/unattended-upgrades.log &gt;/dev/null 2&gt;&amp;1 ; do
      sleep 1
    done
  fi  
  </code></pre>