This seems like a silly question to ask, but I'm struggling to create a compressed archive using ansible then copying that to a remote host. I'm receiving an error that the target directory/file doesn't exist during a copy task. I've verified that he /home/ansible-admin/app/certs directory exists. But from what I can tell, the zip file is never being created.
---
- hosts: example
become: yes
tasks:
- name: Create cert archive
archive:
path:
- /home/ansible-admin/app/certs
dest: /home/ansible-admin/app/app_certs.zip
format: zip
- name: Copy certs to target servers
copy:
src: /home/ansible-admin/app/app_certs.zip
dest: /home/ubuntu/app_certs.zip
owner: ubuntu
group: ubuntu
mode: "0400"
This is the error message I'm consistently getting
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option fatal: [app.example.com]: FAILED! => {"changed": false, "msg": "Could not find or access '/home/ansible-admin/app_certs.zip' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}
I'm hoping I'm just missing something trivial here. But looking at the docs and the yaml file, I'm not seeing where the issue is. https://docs.ansible.com/ansible/latest/collections/community/general/archive_module.html