I am trying to iterate a list ["abc","def","ghi"] & each iteration generates a list which i need to set it to a variable in ansible.
here is my current script:
- name: add checks
set_fact:
CHECKS: "{% for cKey in checkKey %} {{ CHECKS|default([]) }} + {{ CHECKSMAP | map(attribute=cKey ) | list |join(',')}} {% endfor %}"
which generates the following output which is a string & not a list how can i append to the single list similar to list += temp_list in a for loop
ok: [127.0.0.1] => {
"msg": "System [] + [{u'check': u'system_checks'}, {u'check': u'lms_server_health'}] [] + [{u'check': u'system_checks'}, {u'check': u'config-service_server_health'}, {u'check': u'config-service_server_restart'}] " }