- name: Collect information shell: | echo '{"name": "Test", "msg": "Do the real thing here"}' || echo "FAILED" >&2 check_mode: False register: last_result changed_when: False failed_when: "last_result.stderr_lines | length > 0" - name: Add to list if name does not exist set_fact: list_of_information: "{{ list_of_information + [ item ] }}" loop: "{{ last_result.stdout_lines | from_json }}" when: "item.name not in list_of_information | map(attribute='name')"