adhoc command to check all installed packets and their versions

Hi all,
I’m wondering how to check all installed packets and their versions in the box
I can send
ansible all -i /path-to-the-hosts/hosts -a “rpm -q glibc”
but how to check all installed packets
locally I’m using “yum list installed > packs.txt”
thanks in advance
Best Regards

Why not use that call?

ansible -m command -a "yum list installed"

(I tested locally with -a "rpm -qa", which worked)

Johannes