I tried below ansible tasks with copy and unarchive modules and facing error
- name: find and archive
hosts: localhost
tasks:
- name: find the file
copy:
src: "{{ item }}"
dest: "/home/ec2-user/bb"
remote_src: yes
with_fileglob:
- "/home/ec2-user/aa/Data*"
register: result
- name: show the result file path
debug:
msg: "{{ item.path }}"
loop: "{{ result.files }}"
- name: extract file
unarchive:
src: "{{ item.path }}"
dest: /home/ec2-user/cc/
loop: "{{ result.files }}"
the error is:
fatal: [localhost]: FAILED! => {"msg": "'dict object' has no attribute 'files'"}