Hi All,
Request your help on how to sort a dict2item “{{ ansible_facts.packages|dict2items }}”
Hi All,
Request your help on how to sort a dict2item “{{ ansible_facts.packages|dict2items }}”
Request an example for such a data structure
As you know that the module “ansible_facts.packages” collects all the rpm packages installed on a host , so we need to sort those packages in alphabetical order eg: aaa_base, SuSEfirewall2 …
“SuSEfirewall2”: [
{
“arch”: “noarch”,
“epoch”: null,
“name”: “SuSEfirewall2”,
“release”: “1.33”,
“source”: “rpm”,
“version”: “3.6.378”
}
],
“aaa_base”: [
{
“arch”: “x86_64”,
“epoch”: null,
“name”: “aaa_base”,
“release”: “3.42.1”,
“source”: “rpm”,
“version”: “84.87+git20180409.04c9dae”
}
],
Those facts are already sorted.
When it is converted to dict2items the sorting is gone
Are you sure?
What makes you think that?
Please post some evidence in case you do.