1
votes

I am using AWS Opsworks and have a stack of Chef 12.0 .. Question since in Chef 12 cookbook dependency is not supported.. I managed to create a cookbook that install my webserver and deploy an APP .. to support 2 APP in different stack they have different cookbook but has a common file which is installing the webserver (/recipes/webserver.rb) , is there a method that the cookbooks can just inherit/call a common file? Coz I don't want that if there are changes in the webserver recipe I have to update two cookbooks.

Thanks in advance

1
How are dependencies not supported anymore?StephenKing
it does not support berkshelf anymore in chef 12.0 , I just reread the document.. it's quite confusing that it can package dependencies locally. Where am i supposed to upload this in the first place in OpsworksDrixson Oseña
I think the "Packaging Dependencies Locally for Multiple Cookbooks" section in docs.aws.amazon.com/opsworks/latest/userguide/… should answer your question with how you should use Berkshelf. The difference is you need to run it locally and upload all the cookbooks to Opsworks, rather than running it in Opsworks, as before.gsaslis
Hmm.. seems interesting but if I try this method.. it seems I am not using opsworks anymore.. I cannot bind the recipe in stack lifecycle events anymore right?Drixson Oseña
Well, it looks like their recommended way of doing things now with Chef 12, so I wouldn't say "you're not using opsworks anymore" ;) According to the docs, all that should change with Chef 12 and this, is that you now have to manually upload the cookbooks. There shouldn't be any change with regards to how you bind them to lifecycle events... Could you please have a go and let us know what problem you run across?gsaslis

1 Answers

1
votes

You can use include_recipe to include one recipe in another. You also might want to look in to putting the common logic in a custom resource and using that in both application recipes. Check out https://github.com/poise/application_examples/ for some examples of resource-driven application deployment.