Chef – The Local Cookbook Development Badge
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.
Chef Local Cookbook Development Badge
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
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
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
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
This lesson discusses ChefDK and its components. We also discuss what Chef provides, and what the community does.
Local Chef Workstation Setup: ChefDK
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
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
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
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
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
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
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
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
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
The `chef` Command
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
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
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
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
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
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
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
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
In this lesson we will cover the following: How to specify platforms. Common platforms. How to locate base images. Common images and custom images.
In this lesson we discuss the following: The basic Test Kitchen workflow kitchen commandsWhen tests get runHow to install bussers What kitchen init does
Directory Structure of a Cookbook
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
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
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
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.
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
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.
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
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
Reading Test Kitchen Output
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
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
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.
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.
How to Prepare for the Chef Badge Exams
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.
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.
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.