Skip to main content

Chef – The Local Cookbook Development Badge

Course

Intro Video

Photo of Kevin James

Kevin James

Training Architect

Length

09:13:59

Difficulty

Intermediate

Videos

39

Hands-on Labs

5

Course Details

The Chef Local Cookbook Development Badge course is designed to prepare you for the Chef Local Cookbook Development Badge exams. By passing the exams and obtaining this badge, you will demonstrate your ability to properly develop a basic Chef cookbook.

Earning this Chef Badge shows you have the skills to develop a basic cookbook in Chef.It shows you have the ability to take a process that exists and automate it, demonstrating your understanding of creating a cookbook. You will have shown your ability to validate the functionality of the cookbook before it is run on production or 'live' infrastructure.

If you obtain the badge you will be on your way to obtaining Chef certification.

Syllabus

Chef Local Cookbook Development Badge

Introduction

Course Introduction

00:01:56

Lesson Description:

In this lesson, we’ll talk about why anyone would want the Local Cookbook Development Badge, and what we will cover in this course.

About the Exam

00:02:43

Lesson Description:

In this lesson, we’ll cover details about the exam, where it fits into the overall scheme of Chef Certifications, and also mention some tips along the way for preparing to take the exam. There are two versions of the exam: one on a Linux platform, and the other on a Windows platform. The Windows platform used at the time of this course's creation is Windows Server 2012 R2, but it will be updated to use Windows Server 2019. The exam has a combination of multiple choice questions and performance-based screnarios. The exam platform will have Chef DK 2.4.17 installed, and includes pre-installed editors such as Vim and Atom. Exam candidates who fail the exam must wait one week before retrying. Exam vouchers are available for purchase at https://training.chef.io/local-cookbook-development-badge.

Chef Badges Overview

00:02:23

Lesson Description:

In this lesson, we'll discuss the scope of topics that the Local Cookbook Development Badge exam covers. We'll explore the Chef certification website, where exam purchasing and scheduling is available. For more information about the Chef Badges, visit https://training.chef.io/certification The page that covers the Chef Local Cookbook Development Badge is https://training.chef.io/local-cookbook-development-badge

About the Training Architect

00:00:55

Lesson Description:

Introducing the course author: Kevin James I hope you like this course and gain value from it. If you have questions relating to the course, then feel free to contact me in the Community on the Linux Academy website or via our slack channel.

Setup Your Environment

Intro to ChefDK

00:05:19

Lesson Description:

This lesson discusses ChefDK and its components. We also discuss what Chef provides, and what the community does.

Local Chef Workstation Setup: ChefDK

00:03:38

Lesson Description:

This lesson shows how to install the ChefDK software. We obtain it from the URL here: https://downloads.chef.io/chefdk/stable/2.4.17 The commands used to install are:

wget https://packages.chef.io/files/stable/chefdk/2.4.17/el/7/chefdk-2.4.17-1.el7.x86_64.rpm

sudo rpm -ivh chefdk-2.4.17-1.el7.x86_64.rpm 

echo 'eval "$(chef shell-init bash)"' >> ~/.bash_profile

source ~/.bash_profile

Set up Prerequisites on a Linux Server for Local Testing

00:06:29

Lesson Description:

In this lesson we set up Git and Docker, since they are prerequisites for the tasks we will perform in later lessons. We also install the required gem to use with Docker.

Cookbook Authoring and Setup Theory

Repository Structure: Monolithic vs. Single Cookbook

00:05:57

Lesson Description:

In this lesson we discuss the following:The pros and cons of a single repository per cookbookThe pros and cons of an application repositoryHow the Chef workflow supports monolithic vs. single cookbooksHow to create a repository/workspace on the workstation

Versioning of Cookbooks

00:09:04

Lesson Description:

In this lesson we discuss the following:Why cookbooks should be versionedThe recommended methods of maintaining versions (e.g. knife spork)How to avoid overwriting cookbooksWhere to define a cookbook versionSemantic versioningFreezing cookbooksRe-uploading and freezing cookbooks

Structuring Cookbook Content

00:08:29

Lesson Description:

In this lesson we discuss the following:Modular content/reusabilityBest practices around cookbooks that map 1:1 to a piece of software or functionality, as opposed to monolithic cookbooksHow to use common, core resources

How Metadata Is Used

00:04:43

Lesson Description:

In this lesson we discuss the following:How to manage dependenciesCookbook dependency version syntaxWhat information to include in a cookbook, like author, license, etc.Metadata settingsWhat suggests in metadata meansWhat issues_url in metadata means

Wrapper Cookbook Methods

00:03:59

Lesson Description:

In this lesson we discuss the following:How to consume other cookbooks in code via wrapper cookbooksHow to change cookbook behavior via wrapper cookbooksAttribute value precedenceHow to use the include_recipe directiveWhat happens if the same recipe is included multiple timesHow to use the depends directive

Using Community Cookbooks

00:06:55

Lesson Description:

In this lesson we discuss the following:How to use a public and private SupermarketHow to use community cookbooksHow to wrap community cookbooksHow to fork community cookbooksHow to use Berkshelf to download cookbooksHow to configure a BerksfileHow to use a Berksfile to manage a community cookbook and a local cookbook with the same name

Using Chef Resources vs. Arbitrary Commands

00:03:18

Lesson Description:

In this lesson we discuss the following:How to shell out to run commandsWhen/not to shell outHow to use the execute resourceWhen and when not to use the execute resourceHow to ensure idempotence

ChefDK Tools

The `chef` Command

00:13:41

Lesson Description:

In this lesson we will learn the following:What the chef command doesWhat chef generate can createHow to customize content using generatorsThe recommended way to create a templateHow to add the same boilerplate text to every recipe created by a teamThe chef gem command and what it is Note: Code used in this lab can be found on the Linux Academy Github at https://github.com/linuxacademy/content-chef-localcookbookdev/tree/master/Lessons/Chef_Command

Foodcritic

00:09:21

Lesson Description:

In this lesson we discover the following:What Foodcritic isWhy developers should lint their codeFoodcritic errors and how to fix themCommunity coding rules and custom rulesFoodcritic commandsFoodcritic rulesHow to exclude Foodcritic rules

Berks

00:11:59

Lesson Description:

In this lesson we learn about the following:Using berks to work with upstream dependenciesWorking with GitHub and SupermarketDealing with dependent cookbooksTroubleshooting berks issuesLocking cookbook versionsManaging dependencies using berks commands

Rubocop

00:08:44

Lesson Description:

In this lesson we will cover the following topics:How to use RuboCop to check Ruby stylesRuboCop vs. FoodcriticRuboCop configuration and commandsAuto correctionHow to be selective about which rules get run

Test Kitchen

00:08:00

Lesson Description:

In this lesson we will discuss the following:Writing tests to verify intentHow to focus tests on critical outcomesHow to test each resource component vs how to test for desired outcomesRegression testingUsing the kitchen command to test and to converge a cookbook onto a Docker instance

Test Kitchen

Drivers

00:07:26

Lesson Description:

In this lesson we discuss and show examples for the following:Test Kitchen provider and platform supportHow to use .kitchen.yml to set up complex testing matricesHow to test a cookbook on multiple deployment scenariosHow to configure drivers

Provisioner

00:06:23

Lesson Description:

In this lesson we cover the following:The available provisionersHow to configure provisionersWhen to use chef-client vs. chef-solo vs. ChefHow to use the shell provisioner

Suites

00:07:55

Lesson Description:

In this lesson we cover the following:What a suite isHow to use suites to test different recipes in different environmentsTesting a directory for InSpecHow to configure suites

Platforms

00:06:11

Lesson Description:

In this lesson we will cover the following: How to specify platforms. Common platforms. How to locate base images. Common images and custom images.

Kitchen Commands

00:16:20

Lesson Description:

In this lesson we discuss the following:The basic Test Kitchen workflow kitchen commandsWhen tests get runHow to install bussers What kitchen init does

Cookbook Components

Directory Structure of a Cookbook

00:09:44

Lesson Description:

In this lesson we discuss the following: What the components of a cookbook areWhat siblings of cookbooks in a repository areThe default recipe and attributes filesWhy there is a default subdirectory under templatesWhere tests are stored

Attributes and How They Work

00:20:50

Lesson Description:

In this lesson we discuss the following: What attributes areAttributes as a nested hash How attributes are defined How attributes are named How attributes are referenced Attribute precedence levels What Ohai isWhat the platform attribute isHow to use the platform attribute in recipes

Files and Templates

00:14:21

Lesson Description:

In this lesson we discuss the following: How to instantiate files on nodesThe difference between file, cookbook_file, remote_file, and template How two teams can manage the same fileHow to write templatesWhat partial templates areCommon file-related resource actions and propertiesERB syntax

Custom Resources

00:09:33

Lesson Description:

In this lesson we discuss the following: What custom resources areHow to consume resources specified in another cookbookNaming conventionsHow to test custom resources Note: The code refenced in this lesson can be found here on GitHub.

Libraries

00:09:49

Lesson Description:

In this lesson we discuss the following: What libraries are and when to use them Where libraries are stored Note: The code refenced in this lesson can be found here on GitHub.

Available Testing Frameworks

Inspec

00:14:29

Lesson Description:

In this lesson we discuss the following: How to test common resources with InSpec InSpec syntaxHow to write InSpec testsHow to run InSpec testsWhere InSpec tests are stored Note: The code refenced in this lesson can be found here on GitHub.

ChefSpec

00:12:04

Lesson Description:

In this lesson we discuss the following: What ChefSpec isThe ChefSpec value propositionWhat happens when you run ChefSpec ChefSpec syntaxHow to write ChefSpec tests How to run ChefSpec tests Where ChefSpec tests are stored Note: The code refenced in this lesson can be found here on GitHub.

Generic Testing Topics

00:03:35

Lesson Description:

In this lesson we discuss the following: The test-driven development (TDD) workflow Where tests are storedHow tests are organized in a cookbookNaming conventions - how Test Kitchen finds tests Tools to test code "at rest"Integration testing toolsTools to run code and test the outputWhen to use ChefSpec in the workflowWhen to use Test Kitchen in the workflowTesting intentFunctional vs unit testing

Troubleshooting

Reading Test Kitchen Output

00:13:44

Lesson Description:

In this lesson we focus on two things: Test Kitchen phasesAssociated output Note: The code refenced in this lesson can be found here on GitHub

Compile vs. Converge

00:10:04

Lesson Description:

In this lesson we discuss the following: What happens during the compile phase of a chef client run?What happens during the execution phase of a chef client run?When is pure Ruby code executed?When is Chef code executed? Note: The code refenced in this lesson can be found here on GitHub.

Search and Data Bags

Databags

00:18:15

Lesson Description:

In this lesson we discuss the following: What data bags areWhere data bags are stored When to use data bagsHow to use data bagsHow to create a data bagHow to update a data bagHow to search data bagsChef VaultThe difference between data bags and attributes What knife commands to use to CRUD (Create, Read, Update, and Delete) data bags Note: The code refenced in this lesson can be found here on GitHub.

Search

00:09:24

Lesson Description:

In this lesson we discuss the following: What data is indexed and searchableWhy you would search in a recipeSearch criteria syntaxHow to invoke a search from the command line How to invoke a search from within a recipe Note: The code refenced in this lesson can be found here on GitHub.

Course Conclusion

How to Prepare for the Chef Badge Exams

00:03:42

Lesson Description:

The Local Cookbook Development assessment is a blend of multiple choice questions and performance scenarios where you will work with Chef to meet specific objectives. You are given 90 minutes to complete the exam To prepare for the exam I encourage you to do the following: Deploy your own Chef DK server and practice each of the elements shown in this course. Read over the Local Cookbook Development Badge Topics document from Chef. Utilize the search functionality of docs.chef.io to ensure that you can quickly look up information that you don't know. Practice building environments in kitchen. Create some of your own cookbooks based on configuration tasks that you've done in the past. Convert configuration scripts you may have written into recipes to get practice creating recipes and using resources. Go through this course's Hands-On Labs until you feel comfortable carrying out each task without watching the solution videos. Have a look at the code used in the course. It can be found here on GitHub.

Whats Next

00:01:17

Lesson Description:

What are the next steps, now that you have completed the course? If you've successfully taken and passed the Chef Local Cookbook Development Badge exam then congratulations! If you haven't take the exam yet, you should feel confident going into the exam if you've diligently followed along with the examples in this course, taken the quizzes and practice exams, and gone through the live environments. After you have passed the exam it is time to move onto a new challenge. A great next step would be to start preparing for the other badges available from Chef. If you havent gotten the Basic Chef Fluency Badge yet then you could always round things out by adding that one. You can use the search option available on the Linux Academy Website and make use of those courses as well. There is the Extending Chef Badge course which will help you extend your chef knowledge. I hope that you enjoyed this course and felt that it prepared you well for the exam. If there were any parts of the course that you particularly liked or disliked please go back to those pieces of content (videos, live environments, quiz questions, etc.) and leave a rating so that I can continue to improve this course. Thank you for helping us make better content and trusting us with your valuable time.

Get Recognised

00:01:01

Lesson Description:

In this video, Linux Academy Founder and CEO Anthony James explains the steps you can take to get recognized after successfully passing your certification exam. Anthony will explain how to connect with him on LinkedIn and Twitter so that he can endorse you for the skills you have mastered by getting your certification.

Take this course and learn a new skill today.

Transform your learning with our all access plan.

Start 7-Day Free Trial