厨师搜索api互联网界面(Chef search api internet interface)
我目前正在使用以下代码:
elastic_ip = search(:node, 'roles:elastic', filter_result: { 'ip' => ['ipaddress'] })问题是我有多个网络接口,它给了我一个错误的网络接口。
我怎样才能要求不同的网络接口?
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?
最满意答案
Ohai收集node['network']['interfaces']下所有接口的信息,你可以从中获取地址,但你需要一些方法来知道哪一个是正确的.node ['ipaddress']'来自与默认路由关联的接口。
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.
更多推荐
发布评论