I do have a nested dictionary that looks like:
mydict:
system: # <-- group
disk: # <-- command name
cmd: df -a
memory:
cmd: free
hw:
pci:
cmd: lspci
foo: bar
I would like to transform it into a list of dictionaries while saving the first two level keys as keys, as below:
mylist:
- cmd: "df -a"
group: system
name: disk
- cmd: "free"
group: system
name: memory
- cmd: "lspci"
name: pci
group: hw
foo: bar
While I want to use is using json_query() ansible filter, I guess that the question is generic for json-path use.