[英]How to use ohai cloud plugin in chef?
I am very new to chef. 我是厨师的新手。 I have added few cookbooks and it seems all is working. 我添加了一些食谱,看来一切正常。 I am able to run chef on my ec2 node. 我可以在ec2节点上运行Chef。 Now I am trying to set /etc/hosts file, for that I need IPs. 现在,我正在尝试设置/ etc / hosts文件,因为我需要IP。 I found that ohai cloud plugin ( https://github.com/chef/ohai/blob/master/lib/ohai/plugins/cloud.rb ) can do this. 我发现ohai cloud插件( https://github.com/chef/ohai/blob/master/lib/ohai/plugins/cloud.rb )可以做到这一点。 But I don't know how to do that. 但是我不知道该怎么做。
Any suggestions? 有什么建议么?
On EC2 you need to set a hint file in /etc/chef/ohai/hints/ec2.json
. 在EC2上,您需要在/etc/chef/ohai/hints/ec2.json
设置一个提示文件。 The file can be empty (and should be), but it needs to exist to tell Ohai to run the EC2 logic. 该文件可以为空(应该为空),但是它必须存在以告诉Ohai运行EC2逻辑。 This is because there is no good way to know if you are on an EC2 VM only looking at the VM itself. 这是因为没有很好的方法来知道您是否在EC2 VM上,而只是查看VM本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.