set_fact in with_dict append loop only keeps last item

Hi,

set_fact in with_dict append loop only keeps last item . Is there any way to keep the whole list in the set_fact.

  • name: Print records
    set_fact:
    imp_records: “/home/ansible/{{ item.key }}/{{ item.value.version.split(‘_’)[1] }}/{{ item.value.file_name }}”
    when: item.key == ‘imp’
    with_dict: “{{ somevalue }}”

append loops only keeps the last item.

Is there any way we can whole list in the set_fact

what does 'somevalue' look like?

“somevalue”: [
{
“cp”: {
“file_name”: “CXP_902_8057_25.1.1_20190606-091538.tar”,
“md5”: “20f5dfe8b166cc45e6bd4cd48449d4f5”,
“product_name”: “cp”,
“product_number”: “CXP 902 8057”,
“release_candidate”: “RC25”,
“version”: “25.1.1”
}
},
{
“imp1”: {
“file_name”: “IMP1_903_6746_25.0.0_20190612-094816.tar”,
“md5”: “e464e69a07123de075778aa9b761d2ce”,
“product_name”: “device_authentication”,
“product_number”: “CXP 903 6746”,
“release_candidate”: “RC25”,
“version”: “25.0.0”
}
},
{
“imp2”: {
“file_name”: “IMP2_GP14_PCP24_EP01_A.tar.gz”,
“md5”: “b117a1de38d99f11f8157a2d26840ef4”,
“product_name”: “ece”,
“product_number”: “None”,
“release_candidate”: “None”,
“version”: “GP14_PCP24_EP01_A”
}
},
{
“imp”: {
“file_name”: “imp902_7815_25.1.0_20190601-083833.tar”,
“md5”: “6c6fc29c6738c2d227a1a8fb3017cea5”,
“product_name”: “imp”,
“product_number”: “CXP 902 7815”,
“release_candidate”: “RC25”,
“version”: “25.1.0”
}
},
{
“iamaaadapter”: {
“file_name”: “CXP_903_6488_25.1.2_1906190606.tar.gz”,
“md5”: “1ced0063caced27e0417ba65315b0e85”,
“product_name”: “iamaaadapter”,
“product_number”: “CXP 903 6488”,
“release_candidate”: “RC25”,
“version”: “25.1.2”
}
},
{
“iamfedadapter”: {
“file_name”: “CXP_903_6605_25.0.0_1905101559.tar.gz”,
“md5”: “da713bf0a73f863aa4296e4e2fd9af55”,
“product_name”: “iamfedadapter”,
“product_number”: “CXP 903 6605”,
“release_candidate”: “RC25”,
“version”: “25.0.0”
}
},
{
“idp_proxy”: {
“file_name”: “CXP_903_5569_25.0.1_20190705-084530.tar”,
“md5”: “cb8295ba32d4e43550ecd9ba409ff8d1”,
“product_name”: “idp_proxy”,
“product_number”: “CXP 903 5569”,
“release_candidate”: “RC25”,
“version”: “25.0.1”
}
},
{
“notification”: {
“file_name”: “CXP_902_8347_25.1.2_20190612-100040.tar”,
“md5”: “72cc71fdfb826937ed9b417a637b717b”,
“product_name”: “notification”,
“product_number”: “CXP 902 8347”,
“release_candidate”: “RC25”,
“version”: “25.1.2”
}
},
{
“pm”: {
“file_name”: “CXP_902_8056_25.1.1_20190606-090412.tar”,
“md5”: “38eb5777b6161b84be252c942d772b99”,
“product_name”: “pm”,
“product_number”: “CXP 902 8056”,
“release_candidate”: “RC25”,
“version”: “25.1.1”
}
},
{
“profileservicetmo”: {
“file_name”: “CXP_903_7106_25.0.0_1905101654.tar.gz”,
“md5”: “7fad90f7965c99944ae2952a8abb7b77”,
“product_name”: “profileservicetmo”,
“product_number”: “CXP 903 7106”,
“release_candidate”: “RC25”,
“version”: “25.0.0”
}

}
}
]