vagrant : how to get hostonly ip address from within chef recipe?
chef-infra, vagrant
Solution
node[:network][:interfaces][:eth1][:addresses].detect{|k,v| v[:family] == "inet" }.first
Actually you can find out all the node attributes by logging into the VM (with vagrant ssh) and running shef. And inspect there the node object.
Problem
I am trying to retrieve the hostonly ip address specified in the Vagrantfile: ``` config.vm.network :hostonly, "33.33.33.33" ``` in a recipe file : mycookbook/files/default/xdebug.ini ``` [xdebug] zend_extension = "/usr/lib/php/modules/xdebug.so" xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp" xdebug.remote_host = "***HERE***" xdebug.trace_output_dir = "/tmp" xdebug.max_nesting_level = 200 ```