Chef Infrastructure Automation Cookbook - Second Edition

Over 80 recipes to automate your cloud and server infrastructure with Chef and its associated toolset

Chef Infrastructure Automation Cookbook - Second Edition

Cookbook
Matthias Marschall

2 customer reviews
Over 80 recipes to automate your cloud and server infrastructure with Chef and its associated toolset
$35.99
$44.99
RRP $35.99
RRP $44.99
eBook
Print + eBook

Instantly access this course right now and get the skills you need in 2017

With unlimited access to a constantly growing library of over 4,000 eBooks and Videos, a subscription to Mapt gives you everything you need to get that next promotion or to land that dream job. Cancel anytime.

Code Files
Free Sample

Book Details

ISBN 139781785287947
Paperback278 pages

Book Description

Chef is a configuration management tool that lets you automate your more cumbersome IT infrastructure processes and control a large network of computers (and virtual machines) from one master server.

This book takes you through covering the various artifacts of Chef and explains the techniques of building full-fledged real-world solutions. After describing how to use the basic Chef command-line tools such as knife and Berkshelf, the book will show you how to troubleshoot your work. It will also take you through the core concepts of managing users, applications, and your entire cloud infrastructure. This book will help you learn the techniques of the pros by walking you through a host of step-by-step guides to solve real-world infrastructure automation challenges.

Table of Contents

Chapter 1: Chef Infrastructure
Introduction
Using version control
Installing the Chef development kit on your workstation
Using the hosted Chef platform
Managing virtual machines with Vagrant
Creating and using cookbooks
Inspecting files on your Chef server with knife
Defining cookbook dependencies
Managing cookbook dependencies with Berkshelf
Downloading and integrating cookbooks as vendor branches into your Git repository
Using custom knife plugins
Deleting a node from the Chef server
Developing recipes with local mode
Using roles
Using environments
Freezing cookbooks
Running Chef client as a daemon
Using chef-shell
Chapter 2: Evaluating and Troubleshooting Cookbooks and Chef Runs
Introduction
Testing your Chef cookbooks
Flagging problems in your Chef cookbooks
Test-driven development for cookbooks using ChefSpec
Integration testing your Chef cookbooks with Test Kitchen
Showing affected nodes before uploading cookbooks
Overriding a node's run list to execute a single recipe
Using why-run mode to find out what a recipe might do
Debugging Chef client runs
Inspecting the results of your last Chef run
Raising and logging exceptions in recipes
Diff-ing cookbooks with knife
Using community exception and report handlers
Creating custom handlers
Chapter 3: Chef Language and Style
Introduction
Using community Chef style
Using attributes to dynamically configure recipes
Using templates
Mixing plain Ruby with Chef DSL
Installing Ruby gems and using them in recipes
Using libraries
Using definitions
Creating your own Lightweight Resource Providers (LWRP)
Extending community cookbooks by using application wrapper cookbooks
Creating custom Ohai plugins
Creating custom knife plugins
Chapter 4: Writing Better Cookbooks
Introduction
Setting the environment variables
Passing arguments to shell commands
Overriding attributes
Using search to find nodes
Using data bags
Using search to find data bag items
Using encrypted data bag items
Accessing data bag values from external scripts
Getting information about the environment
Writing cross-platform cookbooks
Finding the complete list of operating systems you can use in cookbooks
Making recipes idempotent by using conditional execution
Chapter 5: Working with Files and Packages
Introduction
Creating configuration files using templates
Using pure Ruby in templates for conditionals and iterations
Installing packages from a third-party repository
Installing software from source
Running a command when a file is updated
Distributing directory trees
Cleaning up old files
Distributing different files based on the target platform
Chapter 6: Users and Applications
Introduction
Creating users from data bags
Securing the Secure Shell Daemon (SSHD)
Enabling passwordless sudo
Managing NTP
Managing nginx
Creating nginx virtual hosts
Creating MySQL databases and users
Managing WordPress sites
Managing Ruby on Rails applications
Managing Varnish
Managing your local workstation
Chapter 7: Servers and Cloud Infrastructure
Introduction
Creating your infrastructure using Chef Provisioning
Creating cookbooks from a running system with Blueprint
Running the same command on many machines at once
Setting up SNMP for external monitoring services
Deploying a Nagios monitoring server
Building high-availability services using heartbeat
Using HAProxy to load-balance multiple web servers
Using custom bootstrap scripts
Managing firewalls with iptables
Managing fail2ban to ban malicious IP addresses
Managing Amazon EC2 instances
Loading your Chef infrastructure from a file with spiceweasel and knife

What You Will Learn

  • Set up your local development and testing environment for Chef
  • Debug your cookbooks and Chef runs by using the numerous inspection and logging facilities of Chef
  • Drive your cookbooks from external data or node-specific attributes
  • Manage and scale your cloud infrastructure by automating your configuration management
  • Extend Chef to meet your advanced needs by creating custom plugins for knife and Ohai
  • Test your Chef cookbooks and infrastructure by writing examples

Authors

Table of Contents

Chapter 1: Chef Infrastructure
Introduction
Using version control
Installing the Chef development kit on your workstation
Using the hosted Chef platform
Managing virtual machines with Vagrant
Creating and using cookbooks
Inspecting files on your Chef server with knife
Defining cookbook dependencies
Managing cookbook dependencies with Berkshelf
Downloading and integrating cookbooks as vendor branches into your Git repository
Using custom knife plugins
Deleting a node from the Chef server
Developing recipes with local mode
Using roles
Using environments
Freezing cookbooks
Running Chef client as a daemon
Using chef-shell
Chapter 2: Evaluating and Troubleshooting Cookbooks and Chef Runs
Introduction
Testing your Chef cookbooks
Flagging problems in your Chef cookbooks
Test-driven development for cookbooks using ChefSpec
Integration testing your Chef cookbooks with Test Kitchen
Showing affected nodes before uploading cookbooks
Overriding a node's run list to execute a single recipe
Using why-run mode to find out what a recipe might do
Debugging Chef client runs
Inspecting the results of your last Chef run
Raising and logging exceptions in recipes
Diff-ing cookbooks with knife
Using community exception and report handlers
Creating custom handlers
Chapter 3: Chef Language and Style
Introduction
Using community Chef style
Using attributes to dynamically configure recipes
Using templates
Mixing plain Ruby with Chef DSL
Installing Ruby gems and using them in recipes
Using libraries
Using definitions
Creating your own Lightweight Resource Providers (LWRP)
Extending community cookbooks by using application wrapper cookbooks
Creating custom Ohai plugins
Creating custom knife plugins
Chapter 4: Writing Better Cookbooks
Introduction
Setting the environment variables
Passing arguments to shell commands
Overriding attributes
Using search to find nodes
Using data bags
Using search to find data bag items
Using encrypted data bag items
Accessing data bag values from external scripts
Getting information about the environment
Writing cross-platform cookbooks
Finding the complete list of operating systems you can use in cookbooks
Making recipes idempotent by using conditional execution
Chapter 5: Working with Files and Packages
Introduction
Creating configuration files using templates
Using pure Ruby in templates for conditionals and iterations
Installing packages from a third-party repository
Installing software from source
Running a command when a file is updated
Distributing directory trees
Cleaning up old files
Distributing different files based on the target platform
Chapter 6: Users and Applications
Introduction
Creating users from data bags
Securing the Secure Shell Daemon (SSHD)
Enabling passwordless sudo
Managing NTP
Managing nginx
Creating nginx virtual hosts
Creating MySQL databases and users
Managing WordPress sites
Managing Ruby on Rails applications
Managing Varnish
Managing your local workstation
Chapter 7: Servers and Cloud Infrastructure
Introduction
Creating your infrastructure using Chef Provisioning
Creating cookbooks from a running system with Blueprint
Running the same command on many machines at once
Setting up SNMP for external monitoring services
Deploying a Nagios monitoring server
Building high-availability services using heartbeat
Using HAProxy to load-balance multiple web servers
Using custom bootstrap scripts
Managing firewalls with iptables
Managing fail2ban to ban malicious IP addresses
Managing Amazon EC2 instances
Loading your Chef infrastructure from a file with spiceweasel and knife

Book Details

ISBN 139781785287947
Paperback278 pages
Read More
From 2 reviews

Read More Reviews