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
€17.99 €26.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781785888915
Vendor :
Chef
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 106.97
Mastering Chef
€36.99
Chef Cookbook
€36.99
Mastering Chef Provisioning
€32.99
Total 106.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.