Hello,

im working on a script which will allow several folders synchronization acros multiple servers.
On eachs erver the script will download data from rest of the servers via rsync via ssh (rsync have archive and update attribute).
For this transfer ssh public access key is needed.

When i add new server to the group, i need to:
1) run ssh-keygen on new server and via ssh-copy-id add key it to rest of servers so i can download data from them...
2) do the same on all old servers so each of them can also download data from my new server..

Im thinking how to automate this thing via bash script...

In my bakcup script i already have list of all servers IPs. So i can do some loop acros these IPs, exclude my new server IP and after one time key generation i will be putting this key to all old server IPs... ?
Then how to allow old servers to access this new server. It appears more complicated as i would need to login to each and there i dont know ...

what about somehow sycing files with public keys between existing old servers? Any idea how to bash this? thx