- name: Download application log ansible.builtin.fetch: src: /var/log/myapp/app.log dest: /tmp/collected-logs/ Use code with caution.
The fetch module is essentially the reverse of the copy module. It is most commonly used for collecting log files, configuration backups, or certificates from multiple servers. Basic File Retrieval ansible download file from remote host
To download a file from a remote host back to your local machine using Ansible, the primary tool you'll use is the ansible.builtin.fetch module . While modules like get_url are used to download from the internet to a server, fetch specifically pulls files from your remote nodes to your control node. Core Method: The Fetch Module - name: Download application log ansible
/tmp/collected-logs/webserver1/var/log/myapp/app.log . Downloading a "Flat" File ansible download file from remote host
ansible.builtin.fetch module – Fetch files from remote nodes