[chef] Re: Re: Getting the ipaddress of a specific interface


Chronological Thread 
  • From: Haim Ashkenazi < >
  • To:
  • Subject: [chef] Re: Re: Getting the ipaddress of a specific interface
  • Date: Mon, 15 Aug 2011 07:54:14 +0300

Thanks, The gist I posted before does something similar. It's strange though that it has to be so difficult. Yesterday when the need came up, I thought it would be dead easy :(

Bye

On Mon, Aug 15, 2011 at 3:15 AM, Bryan McLellan < "> > wrote:


On Aug 14, 2011 1:49 PM, "Haim Ashkenazi" < " target="_blank"> > wrote:
> I was wondering if there's an easy way to get the ip address of a specific interface (and not just the main ip adders)?

It isn't as easy as it should be, but you can use this code to do it:

http://tickets.opscode.com/browse/OHAI-88

ipaddress_eth1 = host["network"]["interfaces"]["eth1"]["addresses"].select { |address, data| data["family"] == "inet" }[0][0]

Bryan




--
Haim



Archive powered by MHonArc 2.6.16.

§