Book Image

Chef Cookbook - Third Edition

By : Matthias Marschall
Book Image

Chef Cookbook - Third Edition

By: Matthias Marschall

Overview of this book

Chef is a configuration management tool that lets you automate your more cumbersome IT infrastructure processes and control a large network of computers (and virtual machines) from one master server. This book will help you solve everyday problems with your IT infrastructure with Chef. It will start with recipes that show you how to effectively manage your infrastructure and solve problems with users, applications, and automation. You will then come across a new testing framework, InSpec, to test any node in your infrastructure. Further on, you will learn to customize plugins and write cross-platform cookbooks depending on the platform. You will also install packages from a third-party repository and learn how to manage users and applications. Toward the end, you will build high-availability services and explore what Habitat is and how you can implement it.
Table of Contents (15 chapters)
Chef Cookbook - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

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 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    2016-11-29 21...