I used below Ansible playbook to capture the filename, but I'm facing error
task:
- copy:
src: /tmp/example.tar.gz
dest: /opt/
register: filename
- debug: var=filename
I need to capture the filename and to be displayed on the console.