I have been developing an automated deployment using Capistrano and using Vagrant as my test virtual server.
The thing is, I need the IP of Vagrant to "ssh
into it".
I tried ifconfig
and got the IP but it looks like it is not the exact vagrant IP.
Can anybody help me to get the Vagrant IP?
We are using VirtualBox as a provider and for the virtual box, you can use
VBoxManage
to get the IP addressrun:
and then in
config/deploy.rb
I know this post is old but i want to add a few points to this!
you can try
this will be easy if you have setup a name to your guests individually!
In the terminal type:
I needed to know this to tell a user what to add to their host machine's host file. This works for me inside vagrant using just bash:
open terminal, come to path of your Vagrantfile and write this
(Linux) vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null
(OS X) vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null | pbcopy
The command for Linux also works for windows. I have no way to test, sorry.
source: https://coderwall.com/p/etzdmq/get-vagrant-box-guest-ip-from-host