Get all packages list in the following pattern"packagename-version-arch"

Hello everyone,

I’d like to gather package facts and simply store them into a variable as a list with this pattern: packagename-version-arch.

I’ve tried several things: mapping attributes, select attributes, for. Without any success. I’m not understanding the structure of ansible_facts.packages.

Note that I do not want to use a loop, because doing it for 6k+ items will take too much time.

Example:

“ansible_facts.packages”: {

“389-ds-base”: [

{

“arch”: “x86_64”,

“epoch”: null,

“name”: “389-ds-base”,

“release”: “22.el7_6”,

“source”: “rpm”,

“version”: “1.3.8.4

}

],

“389-ds-base-libs”: [

{

“arch”: “x86_64”,

“epoch”: null,

“name”: “389-ds-base-libs”,

“release”: “22.el7_6”,

“source”: “rpm”,

“version”: “1.3.8.4

}

],

Desired output:

389-ds-base-1.3.8.4-x86_64

389-ds-base-libs-1.3.8.4-x86_64

Thanks