Lechucico
Lechucico

Reputation: 2112

Chef search api internet interface

I'm currently using the following code:

elastic_ip = search(:node, 'roles:elastic',  
                        filter_result: {
                          'ip' => ['ipaddress']
                        })

The problem is that I have more than one network interface, and it gives me a wrong one.

How can I ask for the different network interface?

Upvotes: 0

Views: 40

Answers (1)

coderanger
coderanger

Reputation: 54249

Ohai collects info on all interfaces under node[‘network’][‘interfaces’] which you can get an address from, though you’ll need some way to know which one is correct.`node[’ipaddress’]’ comes from the interface associated with the default route.

Upvotes: 1

Related Questions