简体   繁体   中英

Chef environments in AWS Opsworks

Since AWS Opsworks added support for Chef 12 to Opsworks there seems to be support for chef environments. I am fairly new to chef. As I understood chef environments are stored in the environments/ -folder in my cookbook repo. This is where I thus created a testing.json file with the name attribute using this exact name. I got the template from the chef doku.

I defined a chef_environment-attribute in the custom json of my testing stack setting this environment to 'testing' (my environment).

I am using berks package to package the cookbooks in a tarball. I pull these in via S3 into my example Opsworks-stack. I ran update_custom_cookbooks on my stack which failed with the message that chef could not find the environment testing.

I first noticed that berks package does not include the environment/-folder since it is not a cookbook. Hence, I added the environments folder to the tarball. I tried update the cookbooks again which failed with the same message.

So what's my misconception here? What is opsworks trying to tell me?

OpsWorks Stacks does not support Chef environments. As it is based on Chef Solo, there isn't really a ton of value in supporting. The main difference between roles and envs in normal Chef is that envs can specify cookbook version requirements, however as Solo requires you to have handled dependency resolution beforehand (via berks package in your case), this feature cannot be used. You can make a role with the same attribute information and use that instead. This can be slightly annoying when dealing with env-aware cookbooks that also use Chef Search but since those rarely work on OpsWorks Stacks anyway, this doesn't come up much.

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