参考ページの内容をベースに現代化、一部修正
--- - name: collect files for each hosts hosts: all become: yes gather_facts: false vars: outputdir: /var/tmp logs: - /root/* - /var/tmp/sosreport* - /opt/nec/clusterpro/tmp/* tasks: - shell: find {{logs | join(' ')}} -type f register: file_list ignore_errors: true - fetch: src={{item}} dest={{outputdir}}/{{inventory_hostname}}/ with_items: "{{ file_list.stdout_lines }}"