简体   繁体   English

如何在厨师中使用ohai cloud插件?

[英]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.

相关问题 如何在Ubuntu 14.04.1上安装Chef knife-ec2插件? - How to install Chef knife-ec2 plugin on Ubuntu 14.04.1? 如何在引导节点期间或之后为ohai中的节点或属性设置唯一数据? - How to set unique data for a node in ohai or attributes during bootstrap a node or after this? 传递变量到云配置厨师? - passing variables to cloud-config chef? 刀/厨师-如何捕获命令行参数并传递给厨师食谱 - knife/chef - how to capture command line argument and pass to a chef recipe Chef:如何根据环境(Vagrant,EC2)使用不同的OS默认用户? - Chef: How to use different OS default users based on environment (Vagrant, EC2)? 有什么方法可以自动修改Chef食谱以与其他云提供商一起使用? - Any way to automatically modify Chef recipes to work with different cloud provider? Jenkins Amazon EC2插件配置的Chef Cookbook - Chef Cookbook for Jenkins Amazon EC2 Plugin Configuration 如何通过AWS EC2使用Amazon Cloud Drive数据 - How to use amazon cloud drive data with AWS EC2 如何使用Chef在crontab中设置环境变量? - How to set an environment variable in crontab using Chef? 如何使用Chef自动克隆私有GitHub - How to automate cloning private GitHub with Chef
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM