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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Portugal

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Portugal

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

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 Provisioning
€32.99
Chef Cookbook
€36.99
Mastering Chef
€36.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 the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela