Я использую модуль пользовательских фактов, чтобы вернуть JSON обратно в Ansible 2.9
ok: [Host] => {
"msg": {
"changed": false,
"failed": false,
"msg": "Successfully completed the view storage volume operation",
"storage_status": {
"Message": {
"Controller": {
"AHCI.Embedded.3-1": {},
"RAID.Integrated.1-1": {
"Enclosure": {
"Enclosure.Internal.0-1:RAID.Integrated.1-1": {
"PhysicalDisk": [
"Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1",
"Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1"
]
}
},
"VirtualDisk": {
"Disk.Virtual.0:RAID.Integrated.1-1": {
"PhysicalDisk": [
"Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1",
"Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1"
]
}
}
}
}
},
"Status": "Success"
}
}
}
И я хотел бы присвоить значение "Disk.Virtual.0:RAID.Integrated.1-1
" переменной с помощью модуля set_fact. Используя следующий фильтр:
{{ disks['storage_status']['Message']['Controller']['RAID.Integrated.1-1']['VirtualDisk'] }}
Я могу просто выбрать следующее:
ok : [Host] => {
"msg": {
"Disk.Virtual.0:RAID.Integrated.1-1": {
"PhysicalDisk": [
"Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1",
"Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1"
]
}
}
}
Но я не могу понять, как захватить Disk.Virtual.0:RAID.Integrated.1-1
и назначить его переменная.
Любая помощь / руководство будет принята с благодарностью.
Спасибо