Node IP when there are multiple nics

I have a system with multiple nics, each on a private network. How do I get chef/ohai reporting the IP I want to the chef server when creating the node? The node ends up with an IP that is not routable from the chef server’s lan, which creates problems if I want to use knife-ssh later. Is this problem something I should write an ohai plugin for to override the ipaddress? or are ohai hints enough? Appreciate your thoughts.

This has been one of my torns in my side for so…so long. I’m curious on how other people get this done too, i’ve hacked up ways but never had something that I’d consider repeatable.

I got pointed to this as a “good way” but something about it, makes me not like it. I’m really hoping we get other suggestions in this thread.

This doesn’t really solve your problem, but if you do a knife node show <hostname> and dot-separate the hash keys that lead to your accessible NIC, you can tell knife ssh to use that attribute to connect.
e.g. on AWS, the private IPs get registered as the main IPs in Chef, but to connect via the public IP, I do:knife ssh -a cloud.public_hostname ...
Hope that helps.
-Ameir

Sent from Alto