简体   繁体   中英

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. Now I am trying to set /etc/hosts file, for that I need IPs. I found that ohai cloud plugin ( https://github.com/chef/ohai/blob/master/lib/ohai/plugins/cloud.rb ) can do this. 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 . The file can be empty (and should be), but it needs to exist to tell Ohai to run the EC2 logic. This is because there is no good way to know if you are on an EC2 VM only looking at the VM itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM