Category "idempotent"

How can I get the installed apt packages with Ansible?

I am trying to list all installed packages on my Debian 7 (Wheezy), 8 (Jessie), and 9 (Stretch) machines. There are easy ways dealing with it using APT or

How can I get the installed YUM packages with Ansible?

I am trying to get all the installed YUM packages on an RHEL machine. I can easily get it through using shell commands which is not idempotent and would like to