Trying To Get Certain Package Information In A List Format For All Host

Hello everyone,

I was trying to loop through all my hosts and if a certain package (xauth in this case) was present it would create a list and email that list with this information:

If package was found:
HOSTNAME - PACKAGE_NAME:VERSION

If package was not found:
PACKAGE_NAME Not Found on HOSTNAME

I thought this would work but it does not.

  • name: GATHER INSTALLED PACKAGES INFORMATION
    package_facts:
    manager: auto
    strategy: all
    ignore_errors: True