Diff-ing cookbooks with knife

When working with a Chef server, you often need to know what exactly is already uploaded to it. You edit files such as recipes or roles locally, and commit and push them to GitHub.

However, before you're ready to upload your edits to the Chef server, you want to verify your changes. To do this, you need to run a diff between the local version of your files and the version already uploaded to the Chef server.

Getting ready

You need to have at least one cookbook that you can modify and is uploaded to your Chef server.

How to do it…

After changing a recipe, you can diff it against the current version stored on the Chef server.

Let knife show you the differences between your local version of my_cookbook and the version stored ...

Get Chef Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.