3

I am trying to setup Munin using Chef, and I'm not sure where to put the customizations that are needed. For example, the documentation on Github says to add munin_plugin 'plugin_name', in the client.rb.

While this is fine for right now, it seems to inhibit my ability to download upstream changes from the cookbook, because I'd have to merge or re-write my changes.

What is the correct way of making customizations to a cookbook?

Do I

  • Modify foo/recipe/default.rb (or similar file, like client.rb here)
  • Create a second cookbook, say munin-custom and create a second custom recipe
  • Create a single personalization cookbook, cookbooks/acme_co to put these changes in?
Cody
  • 163
  • 3

2 Answers2

2

The latest trend is to use wrapper cookbooks: http://www.getchef.com/blog/2013/12/03/doing-wrapper-cookbooks-right/ (in case you can't configure that through attributes).

Besides adding additional resources, you can also access resources defined in the upstream cookbook and modify them according to your needs. In case your modifications are only smaller ones, this avoids forking (which I find makes it harder to follow upstream changes than using librarian-chef or Berkshelf with the upstream cookbook).

StephenKing
  • 932
  • 1
  • 8
  • 18
1

Depends on what you mean by customizations.

Implementation-specific modifications go in the attributes section of the cookbook directory structure.

If you're needing to modify the recipes, I'd just fork a branch of the existing cookbook and keep a Development Chef install around to test out merges for changes.

Magellan
  • 4,431
  • 3
  • 29
  • 53
  • Yes it's the "modify recipe" case. So you're saying I should go with the first option and just deal with merge conflicts later? – Cody Jan 09 '14 at 16:49
  • Mostly Yes. But don't do that directly in Production. Best to keep a Dev Chef environment around for testing things on a separate network/VLAN. Your case may be different, but unless there was a major problem or a major upgrade I've rarely needed to go back and merge my cookbooks from upstream. – Magellan Jan 09 '14 at 16:54