Hi Michael,
Your idea triggered the best solution I have found. Thanks.
This is my solution - for people who discover this later.
io.hcs holds the backup we are trying to restore.
sinope.hcs is where we are restoring to.
callisto.hcs is where ansible is run.
There is a (read only) samba share on io.hcs that is permanently open on
callisto.hcs, but can't be used to copy the files over, because the
permissions get altered. But it can be used to copy the archive over.
tar maintains ownership and permissions as default behaviour.
Therefore the tasks are:
- name: get IO to tar up the website
community.general.archive:
path: "/home/ian/BackupFiles/hobson42/var/www/
ianhobson.com/"
dest: /home/ian/BackupFiles/ianhobson.com.gz # will appear in
share as /home/ian/backup/ianhobson.com.gz
delegate_to: io.hcs
- name: create {{ location }} directory
ansible.builtin.file:
path: "{{ location }}"
state: directory
- name: move archive over to target, and extract it.
ansible.builtin.unarchive:
src: /home/ian/backup/ianhobson.com.gz
dest: "{{ location }}"
- name: remove archive
ansible.builtin.file:
path: /home/ian/BackupFiles/ianhobson.com.gz
state: absent
delegate_to: io.hcs
Result is a speed up of between 60 and 100 times!
The files are restored with the correct permissions and ownership. I
think it is necessary that all users are set up on all machines with the
same user numbers in /etc/passwd.
Regards
Ian
--
Ian Hobson
Tel (+66) 626 544 695