I'm trying to automate my backup to the cloud (Strato HiDrive). I configured the cloud storage to be only accessible via rsync (encrypted via ssh).
When doing this manually, it works fine.
localuser$ rsync -rltDvzu --delete -e ssh . remoteuser@rsync.cloud.com:/users/remoteuser/
I tried to convert this into a playbook:
- name: Synchronization of src on the control machine to dest on the remote hosts
synchronize:
src: /raid5/Pictures/
dest: rsync://remoteuser@rsync.cloud.com:/users/remoteuser/
recursive: yes
private_key: /etc/ansible/roles/backup_server/files/id_rsa
set_remote_user: no
copy_links: no
times: yes
checksum: yes
rsync_opts: -e "ssh"
I tried to use the rsync_opts like this, since I think the private_key gets ignored:
-e "ssh -i /etc/ansible/roles/backup_server/files/id_rsa"
The error message is:
"msg": "rsync: Failed to exec ssh -i /etc/ansible/roles/backup_server/files/id_rsa: No such file or directory"
Thanks for your help.
Did you try 'ssh_args'? It's an undocumented option of synchronize task
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.