---
- name: Copy files from remote /tmp/rm/ to local machine
hosts: target_host
gather_facts: no
tasks:
- name: Gather facts about the target host
setup:
- name: Collect files from remote /tmp/rm/
find:
paths: /tmp/rm/
patterns: "*"
file_type: file
recurse: yes
register: remote_files
- name: Copy collected files to local machine
copy:
src: "{{ item.path }}"
dest: /path/to/local/destination/{{ item.name }}
mode: 0644
loop: "{{ remote_files.files }}"
Back to list