2

My current understanding:

  • You can add a recipe to a client. A recipe can contain other recipes.
  • You can add a role to a client. A role can contain other roles and recipes.

Then what's the practical difference between a recipe and a role? Why would I want to make a role consisting of multiple recipes instead of just a recipe consisting of multiple recipes?

4

The only major, practical differences are that roles can't be versioned, and it's easier to search for Chef nodes in a role than Chef nodes that ran a recipe. They're intended to be a lightweight way to group servers that shouldn't contain much business logic. Many implementations eschew roles completely in favor of 'role books' -- basically cookbooks written to behave like roles.

These are two of my favorite posts that cover the topic:

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

http://dougireton.com/blog/2013/02/16/chef-cookbook-anti-patterns/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.