How to find the Vagrant IP?

前端 未结 12 1271
余生分开走
余生分开走 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:56

    I did at VagrantFile:

    REMOTE_IP = %x{/usr/local/bin/vagrant ssh-config | /bin/grep -i HostName | /usr/bin/cut -d\' \' -f4}
    run "ping #{REMOTE_IP}"
    

    As you can see, I used the "%x{}" ruby function.

提交回复
热议问题