Skip to main content
added 13 characters in body
Source Link

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home'/home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/home/vagrant/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f '/home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f '/home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f '/home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f /home/vagrant/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f '/home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"
added 1 character in body
Source Link

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f 'home'/home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f '/home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"
added 249 characters in body
Source Link

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"id_rsa_machine1.pub"

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", , source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

You could generate the keys using shell provisioner ssh-keygen quiet mode, copy the pub key to the project folder and then copy it to the other(s) machine(s) using file provisioner. Assuming /vagrant/ is the project synced folder, it should be something like this:

machine1.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa' ] && ssh-keygen -q -f ~/.ssh/id_rsa -N ''"

machine1.vm.provision "shell", inline: "cp /home/vagrant/.ssh/id_rsa.pub /vagrant/"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/"

machine2.vm.provision "shell", inline: "[ ! -f 'home/vagrant/.ssh/id_rsa_machine1.pub' ] && cat /vagrant/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"

machine2.vm.provision "file", source: "id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa_machine1.pub"
Source Link
Loading