ฉันยังใหม่อยู่ใน Ansible แค่เดินหลงทางได้ยังไงฉันเล่นเป็น language บันทึกกับ ansible. ฉันต้องเป็น language แฟ้มติดตามข้อมูลอยู่ใน:
{
"map": {
"entry": [
{
"string": [
"6a032ae5-3eed-4d20-a9ef-ccbd88118c47"
]
},
{
"string": [
"27617813-e268-4c94-b539-3550a3a8501a"
]
},
{
"string": [
"b39b10fb-0538-42d7-96fc-553eee9c7ded"
]
}
]
}
}
และฉันก็ต้องทำตามรหัสใน ansible ที่จะวิ่งผ่าน language แฟ้ม:
- name: Initialise variables
set_fact:
NEW_CODE_TEMPLATES_IDS: "{{ lookup('file', 'code_template_map/codeTemplate.json') | json_query('map.entry[*].item') }}"
- name: code template id
debug:
var: NEW_CODE_TEMPLATES_IDS
ฉันคาดหวังที่แสดงผลจะเป็นเหมือนต่อไปนี้:
6a032ae5-3eed-4d20-a9ef-ccbd88118c47
27617813-e268-4c94-b539-3550a3a8501a
b39b10fb-0538-42d7-96fc-553eee9c7ded
แต่สำหรับเหตุผลบางอย่างนี่ไม่ได้ดูเหมือนทำงานสำหรับฉัน ไม่มีใครรู้ว่าทำไม?