--- - name: Create archive, copy to local host and delete on remote hosts: all tasks: - name: Create archive ansible.builtin.archive: path: /tmp/rm/* format: tgz dest: /tmp/archive.tgz - name: Copy archive to remote host ansible.builtin.copy: src: /tmp/archive.tgz dest: /tmp/down/{{ inventory_hostname }}.tgz mode: '0644' - name: Delete archive on remote host ansible.builtin.file: path: /tmp/down/{{ inventory_hostname }}.tgz state: absentBack to list