Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Chef Provisioning
Mastering Chef Provisioning

Mastering Chef Provisioning: Render your entire infrastructure as code with Chef

eBook
$24.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering Chef Provisioning

Chapter 2. Knife Tooling and Plugins

In this chapter, we're going to cover the primary command-line tool in the Chef repertoire. Basic Knife functionality is detailed, as well as the use of community plugins and instructions on how to create your own new plugins.

"Knife skills are the gateway drug to good cooking" – Chef Todd Mohr, Certified Culinary Educator (CCE)

In this chapter, the reader will learn to wield Knife and extend its capabilities as needed. Here is the list of topics that will be covered in this chapter:

  • Knife help
  • Knife subcommands
  • Knife to editor integration
  • Knife Windows plugin
  • Knife EC2 plugin
  • Creating new Knife plugins

Knife help

Let's begin with the basics. As with all command-line tools in the Chef toolbox, knife has a rich help system built in. Issuing the command knife --help will display the basic knife syntax help contents. When you issue the knife --help command, you get a list of all the optional parameters, plus a list of all the knife subcommands. In addition, each of the subcommands has its own help content. For example, ask for help with the subcommand node, and you will get the syntax for the full set of node-specific subcommands and options.

Here is what it will look like when you issue the knife node --help command:

Knife help

You can see from this help text that, using the knife node command, you can create nodes, delete nodes, list nodes, show the details of nodes, and much more. Each subcommand available to the knife command has a similar set of rich help details available on demand.

Most of the actions associated with the subcommands have additional syntax help details available, and they can...

Knife subcommands

Now that we have some help skills under our belt, let's take a look at some of the other knife subcommands in greater detail. Using the various knife subcommands, we will manage nodes, cookbooks, recipes, roles, and environments. We will also use knife to do searching of our Chef server data. All of this and more is available using Knife.

We will have a look at some of the most used commands, but also dig deeper into some of the less frequently used commands to better understand what they can do for us.

Knife Bootstrap

You use the knife bootstrap subcommand to install the chef-client on systems so that it can be used on those systems to communicate with the Chef server. The bootstrap process also registers the system with the Chef server to facilitate communication between the two. In addition to installing the chef-client and registering it with the Chef server, bootstrapping also creates a Node object on the Chef server that is used to manage the configuration of the...

Knife to editor integration

Many of the interactive knife subcommands use an editor to create or modify the infrastructure code. The proper integration of your favorite editor is important to a fluid knife experience.

Using the "wait" option

The key to successfully using your editor with knife is to configure it to use the editor's "wait" option. The wait option tells your editor to launch, open the specified file or content, but not return or exit from the launch command until the editor is exited.

In your standard modern OS, launching most applications from the command line will invoke the application and then immediately return control to the command-line shell. The command, in this case, invokes the editor; actually, it executes completely by launching the editor. This is the behavior that needs to be avoided when using the knife commands. Depending on the editor of choice and OS, we may need to configure the "invoke the editor" command so that it does...

Knife Windows plugin

Now, let's take a look at a couple of community knife plugins. We'll start with the Windows plugin. We use the knife Windows plugin when we are working with nodes running the Windows operating system. First, you will need to install the knife Windows plugin and then we will review how to use it to bootstrap a Windows node. Then, we will use some of the search features to see some of the Windows-specific node data.

Installing the Knife Windows plugin

Like many things related to the new ChefDK, installing Chef-specific gems is pretty straightforward and easy. In this case, we want to install the knife-windows gem. The command to do this is:

chef gem install knife-windows

That is all it takes. You are now ready to use the knife Windows plugin.

Bootstrapping a Windows node

Now that we have the knife Windows plugin installed, we can bootstrap our Windows nodes. There are two methods to interface with a Windows system when bootstrapping a node using the knife Windows...

Knife EC2 plugin

Let's continue our community plugin exploration with the knife EC2 plugin. This plugin is used to integrate knife with Amazon cloud instances that allow you to create and manage instances from the command line.

Installing the Knife EC2 plugin

Much like installing the knife Windows plugin, the installation process for the knife EC2 plugin is super easy. The Chef command-line tool comes to our aid once again. Simply issue the following command:

chef gem install knife-ec2

Your installation will be done in a few seconds. You might note that there is a dependent gem installed; it is the fog-aws gem, which the EC2 plugin uses.

Unlike the knife Windows plugin, after the plugin is installed, there is still more to configure to be able to use it. The knife EC2 plugin requires some specific data related to your Amazon account. There are several ways to make the Amazon data available to the EC2 plugin. The data can be used via environment variables, or as knife.rb configuration settings...

Knife help


Let's begin with the basics. As with all command-line tools in the Chef toolbox, knife has a rich help system built in. Issuing the command knife --help will display the basic knife syntax help contents. When you issue the knife --help command, you get a list of all the optional parameters, plus a list of all the knife subcommands. In addition, each of the subcommands has its own help content. For example, ask for help with the subcommand node, and you will get the syntax for the full set of node-specific subcommands and options.

Here is what it will look like when you issue the knife node --help command:

You can see from this help text that, using the knife node command, you can create nodes, delete nodes, list nodes, show the details of nodes, and much more. Each subcommand available to the knife command has a similar set of rich help details available on demand.

Most of the actions associated with the subcommands have additional syntax help details available, and they can be accessed...

Knife subcommands


Now that we have some help skills under our belt, let's take a look at some of the other knife subcommands in greater detail. Using the various knife subcommands, we will manage nodes, cookbooks, recipes, roles, and environments. We will also use knife to do searching of our Chef server data. All of this and more is available using Knife.

We will have a look at some of the most used commands, but also dig deeper into some of the less frequently used commands to better understand what they can do for us.

Knife Bootstrap

You use the knife bootstrap subcommand to install the chef-client on systems so that it can be used on those systems to communicate with the Chef server. The bootstrap process also registers the system with the Chef server to facilitate communication between the two. In addition to installing the chef-client and registering it with the Chef server, bootstrapping also creates a Node object on the Chef server that is used to manage the configuration of the bootstrapped...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • This is the first Chef book focused on provisioning infrastructure as its sole task. The book offers a clear solution to a specific pain point: learn to make your system work faster.
  • Learning better approaches to load balancing and parallelization with this book will save you time
  • By mastering the techniques in this book, you will know how to run an entire fleet of machines without breaking a sweat
  • This book is more helpful than the documentation (https://docs.chef.io/provisioning.html), with a stronger guiding voice and clearer explanations and use cases

Description

This book will show you the best practices to describe your entire infrastructure as code. With the help of this book you can expand your knowledge of Chef because and implement robust and scalable automation solutions. You can automate and document every aspect of your network, from the hardware to software, middleware, and all your containers. You will become familiar with the Chef’s Chef Provisioning tool. You will be able to make a perfect model system where everything is represented as code beneath your fingertips. Make the best possible use of your resources, and deliver infrastructure as code, making it as versionable, testable and repeatable as application software

Who is this book for?

This book is for Software Engineers, System Administrators, or DevOps Engineers who need to quickly deliver reliably consistent infrastructure at scale. You are expected to have intermediate experience with Chef and Ruby and will be reading this book to advance your knowledge and take your skillset to the next level.

What you will learn

  • Use best practices to describe your entire infrastructure as code
  • Automate and document every aspect of your network, from the hardware of individual nodes to software, middleware, and all containers and clouds
  • Create a perfect model system
  • Make the best possible use of your resources and avoid redundancy
  • Deliver on the promise of Infrastructure as Code
  • Scale with ease by properly provisioning their infrastructure
  • Use the best Test Driven Development methodologies

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 27, 2016
Length: 262 pages
Edition : 1st
Language : English
ISBN-13 : 9781785884214
Vendor :
Chef
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 27, 2016
Length: 262 pages
Edition : 1st
Language : English
ISBN-13 : 9781785884214
Vendor :
Chef
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 141.97
Mastering Chef Provisioning
$43.99
Chef Cookbook
$48.99
Mastering Chef
$48.99
Total $ 141.97 Stars icon
Banner background image

Table of Contents

9 Chapters
1. Setting Up a Development Environment on Your Workstation Chevron down icon Chevron up icon
2. Knife Tooling and Plugins Chevron down icon Chevron up icon
3. Leveraging Roles, Environments, and Policies Chevron down icon Chevron up icon
4. Custom Resources Chevron down icon Chevron up icon
5. Provisioning in the Traditional Data Center Chevron down icon Chevron up icon
6. Provisioning in the Cloud Chevron down icon Chevron up icon
7. Test-Driven Development Chevron down icon Chevron up icon
8. Using Chef Provisioning Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(7 Ratings)
5 star 71.4%
4 star 0%
3 star 14.3%
2 star 14.3%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Barry R Jan 03, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
All of the basics where available right away to get up and running quickly. Every example or step by step I followed worked without issues.The third chapter covers roles, environments, and a variety of other pieces of a organizational hierarchy. The explanations are clear and concise and helped me understand and effectively use them. The information for the attributes are especially helpful in that for the first time I found them in one spot and explained without any superfluous details.Another great resource I found in the book was on Custom Resources. I hadn't used Chef in a while and didn't even realize LWRP/HWRP are no longer the preferred way to work. This really seems to simply things and the examples were great and were a good introduction.
Amazon Verified review Amazon
Jay F. Grissom Jul 26, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
All the ambiguous details about chef seem to be answered here...The Chef/DevOps ecosystem has a lot of people that are highly skilled. This is a double edged blade. Lots of smart experienced people generally means that they have a LOT of assumptions about how much you know regarding the tools you're using. Earl has managed to slip all the key details that close the loop in your understanding without overwhelming you.If you've spent any time researching why the starter kit hoses up your Org if you download it more than once, or how your org pem files should be best handled, or what vagrant is and why it is used then you have an idea of the details I'm talking about. There are many little nuggets of useful information throughout this book. Most of the time Earl just slips the jewel right into the context of the topic so smoothly you don't even realize you learned it until you go to do something with your Chef environment and end up leaning on it.This kind of valueable information is the stuff that you would normally have to go research for hours to get a good understanding of. In my opinion, these insights alone more than cover the cost of this book.His use of clear language to explain some very complex topics makes this a must have for anyone serious about server provisioning automation.The title of the book has the word "Mastering" in it. In my experience that often means overly verbose explanations are going to be filler all over the place. In this case the short concise explanations for everything make it a refreshing read that doesn't leave you loaded down with more questions than answers.Admittedly, the reading can be a little dry at times. When that happens it is usually related to laying out steps for getting things done. He has clearly focused on accuracy and doesn't try to impress you with fancy words when he's laying something out. For the most part Earl's character comes through and that is a good thing (he is obviously a pop-culture fan and likes to use terms like super hero to describe good things). The combination of his character and the clarity of this work more than make up for occasional bouts of dry content. Reading this book has kept me up until midnight more than a few night so clearly it's not a snoozer...I'm really pleased that I picked this up and I'm looking forward to reading more from Mr. Waud.
Amazon Verified review Amazon
Earl Waud Jan 09, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Hi.This is Earl, the author of Mastering Chef Provisioning.I apologize for adding a review of my own book, but I wanted to share with potential readers that I disagree with Michael when he states in his review that this book is not about Chef Provisioning. The book actually is all about the many ways of provisioning using Chef.And contrary to what Michael shared, the provisioning feature "Chef Provisioning" has a full chapter dedicated to it (Chapter 8). That chapter teaches what the feature "Chef Provisioning" is and how to use it, and includes separate examples of using "Chef Provisioning" to provision to Vagrant, AWS, and Docker.Check out the table of contents in the "Look Inside" preview and you will see for yourself.I would like to thank Michael for the comment: "The content, itself, is good and covers the process of provisioning new nodes in a variety of on-premise and cloud situations using the knife cli in addition to explaining several of the fundamental aspects of chef including how to make custom resources (which is invaluable)". I agree with him on these points. :-)Thanks,-Earl
Amazon Verified review Amazon
Mindi Jul 19, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great book to begin quickly. I've started to create LWRPs a few times, but couldn't get a couple hours back-to-back to read through the docs and thoroughly understand how to build them. With Chef Provisioning, I'd created a Custom Resource from the book in about 15 minutes. It gave me enough information that I could quickly create and apply what I'd learned to a new solution.
Amazon Verified review Amazon
Brett W. Aug 11, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book for anyone who wants a roadmap to deploy Chef, at scale, to support production applications in an enterprise environment. The book covers both the development and testing of Chef resources, as well as deploying them to both a traditional data center or the cloud. It covers the major players in both the cloud and on-prem including AWS, Azure, Google Compute, OpenStack and VMware. The author's deep experience in leveraging Chef at scale is evident in the writing.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.