Table of Contents
The Chef Cookbook Wrapper Pattern is based upon a design convention where you customize an existing "library" cookbook by using a separate "wrapper" cookbook, which "wraps" the original cookbook with any related configuration changes.
As the Chef community continues to grow, both in the number of active Chef developers and the range of available applications, finding an existing community cookbook that you want to leverage will become more of the norm than the exception. Therefore, it will be easier to find an existing cookbook that you can either use as-is or slightly modify for your own purposes. When possible, it's best to leverage an existing cookbook (assuming that it's actively being maintained) than trying to create your own custom cookbook from scratch or forking a cookbook repository.
Although forking a repository may initially seem like the easiest way to modify an existing cookbook, it will likely cause you more headaches over time as you try to maintain and upgrade your codebase over time. Therefore, it's recommended that you spend the extra time and effort to integrate a Wrapper Cookbook Pattern into your development routine because you will have a more manageable upgrade path for integrating future bug fixes and new functionality.
There are several design advantages and overall benefits to using the Wrapper Cookbook Pattern instead of other methods for making customizations.
There are several types of customizations that are ideal for using the Wrapper Cookbook Pattern.
See Customize a Chef-based ServerTemplate.
The example below demonstrates how to use 'chef-rewind' to use a wrapper cookbook to override a default configuration in a library cookbook.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.