Now to make stuff going automatic we send our ~/.ssh/id_rsa to ‘/root/.ssh/authorized_keys’ and assuming you have a properly
configured ssh-agent which was already identified you have a passwordless access and you can launch command.

I have a script that does basic customisations at :

http://chmouel.com/pub/bootstrap.sh

but you get the idea from there to launch the command the way you want, you can as well scp and ssh it after if you wanted to have some non public stuff in the script.

Here is the full script you need to adjust a few variable at the top of the file and customize it the way you want but that should get you started :