Rsync in cookbook


#1

hi All,
i have an use case where i need to sync two nodes with their delta. (primary —> secondary).
I am trying to use rsync but it prompt for password and comms over ssh is not allowed.
what could be the chef way to acheive this use case?


#2

I think there is no ‘chef way’ file sync between the nodes (except remote_file and etc. but this is not you are looking for.)
But you can call any command you can run from shell. How can you keep them consistent without chef?

If there is no option to sync the files from command line chef will also not be able to do it for you.

(If the rsync is working now without password you may have a user with public key/credentials/etc. which is allowed in your environment. You may need to find the way it is working now. And put these commands to execute block or create a custom resource for this functionality.)

On the source side you can also configure an rsync daemon to listen (working without sshd). You can setup this with chef as well. After this rsyncd is listening and configured properly you can let the secondary node to have a read only access to the folders you need. After that the rsync will work for you from chef and cli too without ssh.