[chef-dev] Re: help on best practices for roles and wrappers


Chronological Thread 
  • From: Sascha Bates < >
  • To: Sean McKenna < >
  • Cc: " " < >
  • Subject: [chef-dev] Re: help on best practices for roles and wrappers
  • Date: Fri, 18 Jan 2013 19:46:31 -0600

Hi Sean, Reality Forge wrote  a blog post a few months ago that I've been using to model some experiments. 

http://realityforge.org/code/2012/11/19/role-cookbooks-and-wrapper-cookbooks.html

We're working through a lot of your same issues at the moment and I'm not sure I have any comments yet on how we are experimenting with the overall wrapping structure, but I can tell you how I've been writing the "library" cookbooks.  My general approach right now is, if I'm engaged in writing a cookbook I think will become a general use cookbook, I iterate like this:

Write a recipe to define optimal flow, test the recipe to make sure it's working like I think it should. 
If I have time, I refactor it back into a definition or LWRP which is a good way to abstract attributes and hide code from devs, creating a clean interface for them.
If I don't have time, I parametrize with default attributes and write up notes in the README about how to override the attrs from a wrapper implementation .

LIke I said, we're still experimenting with wrapper implementations, so I don't have many comments on that yet.

Hopefully the blog link above helps. If you are looking for an example, I pasted an innocuous set of snippets showing a template block from a recipe associated attributes file in both a library cookbook and the wrapper.  I'm no authority and YMMV and all that stuff, but these are certainly good questions to ask as many people are discovering.

Good Luck on your adventures.

Sascha

Sascha Bates | "> | 612 850 0444 | | |
On 1/18/13 5:37 PM, Sean McKenna wrote:
" type="cite">

Hi,

 

We have been using Chef for a while at my company and have been very happy with it.

 

We’ve come to a point where we are making a few changes to the way we use Chef.

 

I’d like to use wrapper cookbooks to wrap generic cookbooks that we can contribute back to upstream. I’d also like to use role cookbooks so that we can version our roles and make incremental changes to the runlists of our machines without risking blowing up prod and without having to do the role-renaming dance. At least that is my thought as of right now.

 

We’ve actually had a good deal of debate on the subject and are working on coming to a consensus, which brings me to the point. Besides the Gangnam-style one (http://devopsanywhere.blogspot.com/2012/11/how-to-write-reusable-chef-cookbooks.html) and a few other high level articles, I haven’t been able to find anything on how people are really doing this (i.e. versioning roles by using role cookbooks and / or using wrapper cookbooks) and what the best practices are.

 

Any help or direction to info sources would be much appreciated.

 

Thanks!

Sean

 





Archive powered by MHonArc 2.6.16.

§