Modularity in Chef cookbooks

Thoughts on modularity while refactoring Chef cookbooks. The dilemma of reusability and complexity and maintainability and… It’s never just black and white.

Finer grain recipes are easier to maintain and to understand. Roles containing lightweight recipes provide high level overview helping to understand the system architecture. Recipes that are too lightweight, however, may provide minimal value and may require combining many recipes into single useful role.

Coarse grained recipes make it easier to keep changes in one place – you edit one file. Recipes that are too heavyweight, however, may become difficult to reuse because they provide more than needed for different use cases.

As system grows in size and complexity, it’s important that we design our automation for easy reuse and optimal change isolation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.