On 7/30/22 12:44, Ian Hobson wrote:
I need advice on speeding up this task:

- name: "restore files to {{ location }}"
   ansible.builtin.copy:
     src:  "/home/ian/backup/hobson42/var/www/ianhobson.com/"
     dest: "{{ location }}"

It copies 5022 files, totalling 109.2Mb, and even though both machines have NVME SSDs and the network is quiet, the task takes over 30 minutes! Note - some of the files are owned by root, and have "600" permissions, which need to be preserved.

I'd recommend to avoid copying thousands of files.

Ideas to try:
- Trigger rsync [1] if most of the files are static
- Pack the files into a single tar.gz and transfer and extract that [2][3]

Ciao, Michael.

[1] https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html

[2] https://docs.ansible.com/ansible/latest/collections/community/general/archive_module.html

[3] https://docs.ansible.com/ansible/latest/collections/ansible/builtin/unarchive_module.html#ansible-collections-ansible-builtin-unarchive-module

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fbb12f70-a0ef-520f-5aa6-ce047b67d66d%40stroeder.com.

Reply via email to