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


Chronological Thread 
  • From: Kayla Townsend < >
  • To: Sascha Bates < >
  • Cc: Sean McKenna < >, " " < >
  • Subject: [chef-dev] Re: Re: help on best practices for roles and wrappers
  • Date: Mon, 21 Jan 2013 15:26:05 -0600

Those of you using role-cookbooks and wrapper cookbooks, how do you use your environment files? I work with Sean, and we've been considering using role-cookbooks to help us specify versions of cookbooks in the runlist. 

So do you guys manually maintain your versions in a role cookbook metadata file for each role? Or do you still use your environment files because you don't have a reason to have more than one version of a service in production at the same time? Did you just do a massive switchover to role cookbooks? Or have you slowly transitioned, having some basic roles as well as role cookbooks for a time?

I appreciate your help!

Kayla


On Fri, Jan 18, 2013 at 7:46 PM, Sascha Bates < " target="_blank"> > wrote:
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 | " target="_blank"> | 612 850 0444 | | |
On 1/18/13 5:37 PM, Sean McKenna wrote:

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.

§