I would like to ssh between the servers using their names rather than their ips.
for example
in order to test this, run i need to vagrant ssh server1
and from their i should be able to run ssh server2
to the second server.
i have the vagrantfile configure that way:
servers=[
{
:hostname => "server1",
:ip => "192.168.100.10",
:box => "hashicorp/precise64",
:ram => 512,
:cpu => 1,
},
{
:hostname => "server2",
:ip => "192.168.100.11",
:box => "hashicorp/precise64",
:ram => 512,
:cpu => 1,
}
]
Vagrant.configure(2) do |config|
servers.each do |machine|
config.vm.define machine[:hostname] do |node|
machine [:provisions].each do |script|
node.vm.provision :shell, :path => script
end
node.vm.box = machine[:box]
node.vm.hostname = machine[:hostname]
node.vm.network "private_network", ip: machine[:ip]
node.vm.provider "virtualbox" do |vb|
vb.memory = machine[:ram]
vb.cpus = machine[:cpu]
end
end
end
end
i tried to enter the server 1 by vagrant ssh server1
and there i did ssh server2 but it ask me for a password?
how can i enter without password?
10x
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c7500ffd-e168-4987-b1f1-16aca8219ded%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c7500ffd-e168-4987-b1f1-16aca8219ded%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Alvaro
numnodes=2 baseip="192.168.10" #global script $global = <<SCRIPT #check for private key for vm-vm comm [ -f /vagrant/id_rsa ] || { ssh-keygen -t rsa -f /vagrant/id_rsa -q -N '' } #deploy key [ -f /home/vagrant/.ssh/id_rsa ] || { cp /vagrant/id_rsa /home/vagrant/.ssh/id_rsa chmod 0600 /home/vagrant/.ssh/id_rsa } #allow ssh passwordless grep 'vagrant@node' ~/.ssh/authorized_keys &>/dev/null || { cat /vagrant/id_rsa.pub >> ~/.ssh/authorized_keys chmod 0600 ~/.ssh/authorized_keys } #exclude node* from host checking cat > ~/.ssh/config <<EOF Host node* StrictHostKeyChecking no UserKnownHostsFile=/dev/null EOF #populate /etc/hosts for x in {11..#{10+numnodes}}; do grep #{baseip}.${x} /etc/hosts &>/dev/null || { echo #{baseip}.${x} node${x##?} | sudo tee -a /etc/hosts &>/dev/null } done #end script SCRIPT Vagrant.configure("2") do |config| config.vm.provision "shell", privileged: false, inline: $global prefix="node" #node box (1..numnodes).each do |i| vm_name = "#{prefix}#{i}" config.vm.define vm_name do |node| node.vm.box = "hashicorp/precise64" node.vm.hostname = vm_name ip="#{baseip}.#{10+i}" node.vm.network "private_network", ip: ip end end end
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a8a85dc1-0b98-4f12-b5a6-aac402a3733b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a8a85dc1-0b98-4f12-b5a6-aac402a3733b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Alvaro
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/66a6a810-659e-4f9f-ba2b-789ce4ab14f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/66a6a810-659e-4f9f-ba2b-789ce4ab14f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Alvaro
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/9767f900-aaea-490a-bd20-ca5569a807a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.