0
votes

I have a question regarding the installation of software in a chef cookbook. For the questions sake, please assume that there is no chef cookbook providing this functionality.

Say I want to install nginx from source. I see some sources online archiving this by using a chef recipe. However some sources use chef resources and the action :install, where they basically define a chef recipe.

Where is the difference in these approaches. In both cases I could stop the nginx service by either doing so via bash in a recipe or the nginx_ressource :stop functionality (which would wrap a bash command).

1

1 Answers

1
votes

I think you're talking about cookbooks heavy on recipe code vs. cookbooks heavier on custom resources. Recipe code is the heart of Chef, but it turns out that trying to write a single recipe file that can handle all the various use cases on a community cookbook leads to code that is borderline impossible to maintain. As such, most major community cookbooks have moved to a new style using a lot more custom resources, some actually have nothing else in them anymore. For simpler cookbooks that only have to address one use case, either way works.