我有一个如下的json:
"instances": {
"biometricsManagerInstance": {
"appId": "biometrics-manager",
"spawnType": "uniqueSiteWide"
},
"videoSensorInstance": {
"appId": "video-sensor",
"spawnType": "reuse"
},
"faceDetectionInstance":{
"appId": "face-detection",
"spawnType": "reuse"
},
"faceMatchingInstance":{
"appId": "face-matching",
"spawnType": "new"
},
"faceAnnotatorInstance":{
"appId": "face-annotator",
"spawnType": "new"
}
}我有一个存储json的变量。假设: my_json_contents我想用这个数据创建一个字典,它的值如下:
{"biometrics-manager":"biometricsManagerInstance","video-sensor":"videoSensorInstance","face-detection":"faceDetectionInstance",..}我想用ansible来实现它。Help是appreciated.TIA。
发布于 2018-08-24 00:06:52
您的位置如下:
- set_fact:
instances_modified: "{{ instances_modified | default({}) | combine({item.1.appId: item.0}) }}"
loop: "{{ instances | dictsort }}"https://stackoverflow.com/questions/51989823
复制相似问题