Contents

About the Authors

About the Technical Reviewers

Acknowledgments

Introduction

imageChapter 1: Introduction

Infrastructure as Code

Overview

Nodes

Workstation

Server

The Value of Chef

Why Chef?

Core Principles of Chef

Idempotence

Thick Client, Thick Server

Order of Execution

Who Uses Chef?

Key Technologies

Ruby

Erlang

imageChapter 2: The Chef Server

The Chef Server

Types of Chef Server

Extra Functionalities in Enterprise Chef

Components of Open Source Chef Server

imageChapter 3: Installation

Install the Chef Server

Prerequisite

Installation

Installation on a Virtual Machine

File System locations

Configuration

Optional Settings

imageChapter 4: Workstation

Prerequisite

Operating System Support

Install and Configure a Workstation

imageChapter 5: Nodes

Types of Nodes

Node Names

Manage Nodes

Chef Client

The Chef Run

Install and Configure the Node

Identify the Operating System

Bootstrap

Configuring

imageChapter 6: Working with Knife

Working with Knife

Bootstrap

Client

Configure

Cookbook

Cookbook Site

Data Bag

Delete

Download

Environment

Node

Recipe List

Role

Search

Show

SSH

Tag

Upload

imageChapter 7: Cookbooks

Basics of Cookbooks

Cookbook Directory Structure

Recipes

Resources and Providers

Attributes Files

Definitions

Libraries

Metadata

imageChapter 8: Using Cookbooks

MySQL(4.1.2)

Platform

Dependencies

Prerequisite

Cookbook Download

Cookbook Upload

Client Run

Nginx(2.4.2)

Platform

Dependencies

Prerequisite

Cookbook Download

Cookbook Upload

Client Run

Squid(0.4.0)

Platform

Cookbook Download

Cookbook Upload

Client Run

Wordpress(2.1.0)

Platform

Dependencies

Prerequisite

Cookbook Download

Cookbook Upload

Client Run

Tomcat(0.15.0)

Platform

Dependencies

Cookbook Download

Cookbook Upload

Client Run

imageChapter 9: Developing a Cookbook

Developing Your First Cookbook

Writing a Recipe

Creating the Index File

Changing the Metadata

Uploading the Cookbook

Running the Cookbook

Add an Attribute

Add a Resource to the Default Recipe

Add the Template File

Uploading and Running the Cookbook

Using Environments

imageChapter 10: Lightweight Resource Providers

Lightweight Resource Providers

Chef-Maintained LWRPs

Creating an LWRP

imageChapter 11: High Availability

Prerequisite

Setting Up HA

Streaming Replication

Cookbook Replication

Enterprise Chef HA

imageChapter 12: Cloud Provisioning Using Chef

Provisioning Using Vagrant and Chef

Providers and Provisioners

Installing Vagrant

Install Virtual Box

Install Vagrant on Windows

Verifying Vagrant Installation

Configuring Vagrant

Vagrant Boxes (OS Images)

Two Methods to Download Vagrant Box

Vagrantfile

Provisioning a New Instance

Connecting to a Virtual Machine

Suspending the Virtual Machine

Halting the Virtual Machine

Destroying the Virtual Machine

Installing Vagrant Plug-Ins

Vagrant Provisioning Using Chef

Chef Solo Provisioner

Options

Specifying a Run List

Specifying Roles

Using Data Bags

Specifying Node Name

Custom JSON Data

Provisioning Chef Client

Adding Run List

Deleting the Node Details

Verifying Chef Client Registration with Chef Server

AWS and Chef Provisioning Using Vagrant

Installing the Plug-ins

Adding the AWS Box to Vagrant

Vagrantfile for AWS Provisioner

Provisioning Using Knife

Knife EC2 Plug-ins

Knife Azure Plug-ins

imageChapter 13: Troubleshooting and Debugging

Chef Troubleshooting and Debugging

Debugging Chef Client Run

Running Chef Client with an Empty Run List

Running Chef Client in Debug Mode

Using Chef Client Log Files

Types of Log Errors

Using Chef Handler Cookbook

Debugging Recipes Using Logs

Common Errors

Using a Log Resource

Debugging Recipes Using Chef Shell

Configuring Chef Shell

Debugging Recipes Using Breakpoint Resource

Troubleshooting Chef Client

Chef Client Fails to Run a Recipe Successfully at Bootstrapping

Reregistering a Removed Client

Issues Registering Chef Client with the Server

401 Unauthorized Errors

Clock Synchronization Error

No Such File or Directory: /etc/chef/validation.pem

Cannot Find Config File

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset