Book Image

Chef Infrastructure Automation Cookbook

By : Matthias Marschall
Book Image

Chef Infrastructure Automation Cookbook

By: Matthias Marschall

Overview of this book

Table of Contents (14 chapters)
Chef Infrastructure Automation Cookbook Second Edition
About the Author
About the Reviewers

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 like 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 against the version already uploaded to the Chef server.

Getting ready

You need to have at least one cookbook you can modify and which 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 on the Chef server, by running:

mma@laptop:~/chef-repo $ knife diff cookbooks/my_cookbook
diff --knife cookbooks/my_cookbook/recipes/default.rb cookbooks/my_cookbook/recipes/default.rb
--- cookbooks/my_cookbook/recipes/default.rb    2014-12-29...