title: Generic way to list installed packages using Ansible
body: <p>Right now in my current setup I am using Ansible with CentOs hosts.
  One of the tasks contains the following line:</p>
  
  <pre><code>command: yum list installed somepackagename
  </code></pre>
  
  <p>As seen above the task will only work for hosts which support <code>yum</code> , but what if I want to run it on Ubuntu or some other Linux distribution?<br>
  After researching a bit online I found out that there is a generic package manager called <code>package</code>. With this I install/uninstall packages without worrying about the underlying hosts but not do something like <code>list</code> them as seen above.
  Is there any module or any way I could achieve this in a generic way without creating multiple <code>when</code>s?</p>