---
- hosts: all
tasks:
- name: Read the file
command: cat the_file
register: the_file
- name: Reduce them
set_fact:
result: "{{ the_file.stdout }}"
reduce: yes # magic option
When the_file in each host written as "a", "b", "c" respectively, is it possible to get the variable like ["a", "b", "c"] or "abc"?
Hosts are not connected by ssh each other, but only from the playbook running one.