Listing installed packages

I know I can use the package_facts module to retrieve a list of installed packages, but I’m having trouble formatting these. I’d like to format it similar to the following:

Package: Version:

Currently I’m doing the following (I’m showing only httpd but ultimately I’d like to list out ALL installed packages:

You can use templating to have it on one line...

But be careful :
- you can have more than one version of a package installed. Example: kernel
- you can have one x86_64 and one i686 or i386 version of a package installed

Regards,

This very question was asked (and answered) a few weeks ago:

https://groups.google.com/g/ansible-project/c/FsrlY_57hfo/m/x8jt7LMuBQAJ