Hi Jon,
Thank you for your response.
I’m trying to iterate over a dictionary in the form of:
firmware:
PowerEdge_730xd:
bios:
url: [http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE](http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE)
filename: BIOS_XR23Y_WN64_1.2.10.EXE
target_version: 1.2.10
search: none
minimum_version: none
idrac:
url: [http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE](http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE)
filename: iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE
target_version: 2.10.10.10
search: none
minimum_version: none
PowerEdge_720xd:
bios:
url: [http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE](http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE)
filename: BIOS_XR23Y_WN64_1.2.10.EXE
target_version: 1.2.10
search: none
minimum_version: none
idrac:
url: [http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE](http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE)
filename: iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE
target_version: 2.10.10.10
search: none
minimum_version: none
PowerEdge_620xd:
bios:
url: [http://downloads.dell.com/FOLDER02797483M/1/BIOS_CNN4X_WN64_2.5.2.EXE](http://downloads.dell.com/FOLDER02797483M/1/BIOS_CNN4X_WN64_2.5.2.EXE)
filename: BIOS_CNN4X_WN64_2.5.2.EXE
target_version: 2.5.2
search: none
minimum_version: none
Here is the snippet from the playbook:
- debug: var=Model
- debug: msg={{ item.key }}
when: item.key == 'idrac'
with_recursive:
- { name: dict, args: firmware }
- { name: dict, args: "{{item.value}}" }
The above outputs:
TASK: [idrac-firmware | debug var=Model] **************************************
ok: [<some server>] => {
"var": {
"Model": "PowerEdge_R730xd"
}
}
TASK: [idrac-firmware | debug msg={{ item.key }}] *****************************
skipping: [<some server>] => (item={'key': 'bios', 'value': {'url': '[http://downloads.dell.com/FOLDER02797483M/1/BIOS_CNN4X_WN64_2.5.2.EXE](http://downloads.dell.com/FOLDER02797483M/1/BIOS_CNN4X_WN64_2.5.2.EXE)', 'search': 'none', 'target_version': '2.5.2', 'minimum_version': 'none', 'filename': 'BIOS_CNN4X_WN64_2.5.2.EXE'}})
skipping: [<some server>] => (item={'key': 'os_collector', 'value': {'url': '[http://downloads.dell.com/FOLDER02775623M/1/Diagnostics_Application_5W2KP_WN64_OSC_1.1_X10-00.EXE](http://downloads.dell.com/FOLDER02775623M/1/Diagnostics_Application_5W2KP_WN64_OSC_1.1_X10-00.EXE)', 'search': 'none', 'target_version': 1.1000000000000001, 'minimum_version': 'none', 'filename': 'Diagnostics_Application_5W2KP_WN64_OSC_1.1_X10-00.EXE'}})
skipping: [<some server>] => (item={'key': 'bios', 'value': {'url': '[http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE](http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE)', 'search': 'none', 'target_version': '1.2.10', 'minimum_version': 'none', 'filename': 'BIOS_XR23Y_WN64_1.2.10.EXE'}})
ok: [<some server>] => (item={'key': 'idrac', 'value': {'url': '[http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE](http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE)', 'search': 'none', 'target_version': '2.10.10.10', 'minimum_version': 'none', 'filename': 'iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE'}}) => {
"item": {
"key": "idrac",
"value": {
"filename": "iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE",
"minimum_version": "none",
"search": "none",
"target_version": "2.10.10.10",
"url": ["http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE"](http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE)
}
},
"msg": "idrac"
}
skipping: [<some server>] => (item={'key': 'bios', 'value': {'url': '[http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE](http://downloads.dell.com/FOLDER02868051M/1/BIOS_XR23Y_WN64_1.2.10.EXE)', 'search': 'none', 'target_version': '1.2.10', 'minimum_version': 'none', 'filename': 'BIOS_XR23Y_WN64_1.2.10.EXE'}})
ok: [<some server>] => (item={'key': 'idrac', 'value': {'url': '[http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE](http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE)', 'search': 'none', 'target_version': '2.10.10.10', 'minimum_version': 'none', 'filename': 'iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE'}}) => {
"item": {
"key": "idrac",
"value": {
"filename": "iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE",
"minimum_version": "none",
"search": "none",
"target_version": "2.10.10.10",
"url": ["http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE"](http://downloads.dell.com/FOLDER02881013M/1/iDRAC-with-Lifecycle-Controller_Firmware_FM1PC_WN64_2.10.10.10_A00.EXE)
}
},
"msg": "idrac"
}
What I’m trying to get to is something that will only return the one idrac entry.
Something like:
- debug: msg={{ item.key }}
with_recursive:
- { name: dict, args: firmware, when: "{{ Model }}" == "{{ item.key }}" }
- { name: dict, args: "{{item.value}}", ``when: "{{ item.key }}" == 'idrac'`` }