Setting up ssh between two vagrant VMs

22 views
Skip to first unread message

Siva Sukumar Reddy

unread,
Nov 1, 2017, 6:25:51 PM11/1/17
to Vagrant
I'm running Ubuntu16.04 as host machine.
On the top of it, I have one Master Vagrant VM, one Slave Vagrant VM.
I've assigned ip addresses to them using private network Master - 192.168.1.2, Slave - 192.168.1.3
How do I setup ssh between those two VMs so that they can access one another without password.
I tried a lot to setup that and messed up everything related to ssh configuration files. But nothing worked.
Any suggestion would be greatly helpful.

Alvaro Miranda Aguilera

unread,
Nov 1, 2017, 7:11:33 PM11/1/17
to vagra...@googlegroups.com
hello

its more a OS question rather than a Vagrant question

I did share this week a project that does ssh password less

or you can check post like this:

alvaro


--
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/a16350ea-8b9e-461c-bc2f-666c25dd5406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Joaquin Menchaca

unread,
Nov 10, 2017, 2:13:38 PM11/10/17
to Vagrant
This ultimately has to be done at the provisioning level, you would need to have access to the private key for them to automatically log into each other, and you should set up the /etc/hosts (or use a dnscache).  One method is with the default /vagrant available, you can access the keys from /vagrant/.vagrant from within each VirtualMachine.

I have some scripts online where I do this.  I did this with shell, here's an example of config_ssh() function:
I also did the same thing with Ansible:
Feel free to use that code, just give me credit. :)

- Joaquin Menchaca
Reply all
Reply to author
Forward
0 new messages