How to find the Vagrant IP?

前端 未结 12 1266
余生分开走
余生分开走 2021-01-30 08:17

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

12条回答
  •  情歌与酒
    2021-01-30 08:53

    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:

    external_ip=$(cat /vagrant/config.yml | grep vagrant_ip | cut -d' ' -f2 | xargs)
    echo -e "# Add this line to your host file:\n${external_ip}     host.vagrant.vm"
    

提交回复
热议问题