如何从中创建列表
with_items
? 我尝试了以下操作,但它只记录最后一个组ID,而不是创建列表。
- name: "Generate list"
set_fact:
my_new_list: "{{ [ item.group_id ] }}"
with_items:
- "{{ec2_info.instances[0].security_groups}}"
ec2_info.instances[0].security_groups
"security_groups": [
{
"group_id": "sg-0500c5b20f7c152b4",
"group_name": "ManageIQ"
},
{
"group_id": "sg-062178ea5fabaf350",
"group_name": "launch-wizard-1"
}
],