Learning Chef for Linux and macOS

Video description

Chef is a popular configuration management tool used to quickly automate an entire fleet of machines. Chef allows you to define repeatable administration patterns in code tailored to your organization's specific needs. While typically deployed in conjunction with a Chef Server, Chef expert Mischa Taylor shows the numerous applications for Chef that do not require a Chef Server.

You will start using Chef to do useful infrastructure automation immediately for your organization. In this course, he shows you how to use Chef to fully automate the configuration of a fleet of Linux and/or macOS development machines and how to validate the configuration "test first" with InSpec. Designed for learners with basic command line interface skills who are new to Chef, the infrastructure automation skills acquired in this course will be completely applicable when you're ready to take on Chef Server.

  • Discover the practical application of Chef without the complexity of needing to configure a Chef Server
  • Understand all the key components of Chef, including its programming language
  • Explore InSpec, the testing and compliance language included with Chef
  • Master skills transferrable to learning enterprise-oriented Chef Server
  • Learn how to use Chef to install Chef
Mischa Taylor is a former consulting engineer at Chef, where he specialized in providing coaching and training on continuous delivery. He currently builds autonomous systems and maintains the Boxcutter open-source project he created. Mischa has worked in IT since 1992 as a DevOps architect, software engineer, developer, and more. He is the author of the O'Reilly titles "Learning Chef" (with Seth Vargo) and "Infrastructure Automation is on the Menu with Chef."

Table of contents

  1. Introduction
    1. Introduction
    2. Why Chef?
    3. About The Author
  2. Getting Started With The ChefDK
    1. What Is A Chef Development Workstation?
    2. Linux Setup - Installing The ChefDK And Git Source Control
    3. Linux Setup - Installing Atom
    4. Macos Setup - Installing The ChefDK
    5. Macos Setup - Installing Git
    6. Macos Setup - Installing Atom
  3. Your First Chef Program
    1. Why Model Your Infrastructure As Code?
    2. Hello World
    3. Examining Hello.Rb
    4. Linting Code With Cookstyle
    5. Running Cookstyle Within Atom
    6. Automated Verification With Inspec
    7. Resilient Infrastructure With Chef
    8. Handling Uninstalls
    9. Wrapping Up
  4. Getting Started With Test Kitchen
    1. Why Use Test Kitchen?
    2. Test Kitchen And Docker
    3. What If My Machine Can't Run Docker?
    4. What If I Want To Target Macos?
    5. Installing Docker On Linux
    6. Installing Docker On Macos
    7. Docker And Digitalocean
    8. Introducing Test Kitchen
    9. YAML Basics
    10. Validating YAML In Atom
    11. Test Kitchen Configuration File Format Overview
    12. Wrapping Up
  5. How Chef Discovers Information About A System
    1. Why Does Chef Probe Machine Configuration?
    2. What Is A Node?
    3. Chef-Client In Production
    4. Your First Chef-Client Run
    5. Chef-Client Modes
    6. What Is Ohai?
    7. Wrapping Up
  6. Your First Cookbook - Message Of The Day
    1. Why Automate Message Of The Day?
    2. Cookbooks
    3. Your First Chef Run In Test Kitchen
    4. Test First Coding - Part 1
    5. Test First Coding - Part 2
    6. Kitchen Test
    7. Why Files/Default?
    8. Introduction To Regular Expressions
    9. Cookbook Generators
    10. Generator Issues With Copyright Notices
    11. Wrapping Up
  7. Managing Settings With Chef
    1. Why Does Chef Have An Attribute Store?
    2. Accessing And Storing Values
    3. Motd_Attributes Cookbook
    4. Automatic Values
    5. Setting Attributes In Recipes
    6. Setting Values In Attributes
    7. Basic Attribute Priority - Automatic Attributes Rule Them All
    8. Values In Recipes Override Attributes
    9. Last-In Wins At The Same Precedence Level
    10. What If I Have More Than One Attribute File?
    11. Composed Attributes
    12. Include_Recipe
    13. Override Precedence
    14. Attribute Driven Uninstalls
    15. Wrapping Up
  8. Cookbook Authoring And Use
    1. Why Automate Web Server Configuration?
    2. Four Basic Resources
    3. Plan For Development
    4. Cookbook Documentation And Metadata Are Important
    5. Package Resource
    6. Actions Have Defaults
    7. Service Resource
    8. Add Content To The Website
    9. Verifying NGINX On Your Host
    10. Wrapping Up
  9. Cookbook Versioning
    1. Why Versioning?
    2. Versioning The NGINX Cookbook And Communicating Change
    3. Introduction To Git
    4. Sharing Source On Github
    5. Cookbook Pipelines With Travis CI
    6. Managing NGINX.Conf - Breaking Change
    7. Zero Downtime - Enhancement
    8. Wrapping Up
  10. Automated Validation With Inspec
    1. Why Automate Validation?
    2. Scanning A Docker Node With A Hardening Profile
    3. Scanning A Node With A Hardening Profile Via SSH
    4. Scanning A Local Machine With Inspec
    5. Formatting Modes
    6. Control Resource
    7. Describe Block
    8. Its Form
    9. Wrapping Up
  11. Compliance Profile Authoring And Use
    1. Why Translate Compliance Policy Into Code?
    2. Your First Compliance Profile
    3. Creating The Initial Structure And Metadata
    4. Make Tests Fail As You Are Writing Them
    5. Introducing Match
    6. Variable Regular Expressions
    7. Adding Ruby Code To A Control
    8. Packaging Ruby Code In A Custom Matcher
    9. Wrapping Up
  12. Compliance Profiles In Cookbooks
    1. Why Use Inspec With Test Kitchen?
    2. Remote Inspec Profiles
    3. Bringing Node Into Compliance Guided By Tests
    4. Wrapping Up
  13. Capturing Machine Configurations With HashiCorp Packer
    1. Automating Config Of The OS Itself
    2. Host Versus Guest
    3. Host Setup
    4. Creating A Linux Desktop Virtual Machine
    5. Installing Ubuntu 16.04 Desktop
    6. Capturing The Linux Desktop VM With Packer
    7. Verifying The Linux Desktop VM
    8. Creating A Macos Virtual Machine
    9. Installing Macos
    10. Capturing The Macos VM With Packer
    11. Verifying The Macos VM
    12. Wrapping Up
  14. Real-World Example: Manage Your Development Environment With Chef
    1. Why Use Chef To Chef Up Your Chef?
    2. Planning The Cookbooks
    3. Creating The Chef_Workstation Wrapper Cookbook
    4. Berkshelf And Dependency Management
    5. Introducing The Depends Statement And Semantic Versioning
    6. Performing Chef Runs Locally
    7. Git Cookbook
    8. Atom Cookbook
    9. ChefDK Cookbook
    10. Final Local Chef Run
    11. Wrapping Up
  15. Troubleshooting Chef
    1. Troubleshooting Chef
    2. Introducing Chef-Shell
    3. Interactive Debugging with Chef-Shell
    4. Profiling
  16. Where To Go Next
    1. Wrap Up

Product information

  • Title: Learning Chef for Linux and macOS
  • Author(s): Mischa Taylor
  • Release date: April 2017
  • Publisher(s): Infinite Skills
  • ISBN: 9781491959435