PacktLib: Puppet 3 Cookbook

Puppet 3 Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Puppet Infrastructure

Introduction

Installing Puppet

Creating a manifest

Managing your manifests with Git

Creating a decentralized Puppet architecture

Writing a papply script

Running Puppet from cron

Deploying changes with Rake

Bootstrapping Puppet with Rake

Automatic syntax checking with Git hooks

Puppet Language and Style

Introduction

Using community Puppet style

Checking your manifests with puppet-lint

Using modules

Using standard naming conventions

Using inline templates

Iterating over multiple items

Writing powerful conditional statements

Using regular expressions in if statements

Using selectors and case statements

Using the in operator

Using regular expression substitutions

Writing Better Manifests

Introduction

Using arrays of resources

Using definitions

Using dependencies

Using tags

Using run stages

Using node inheritance

Passing parameters to classes

Using class inheritance and overriding

Writing reusable, cross-platform manifests

Getting information about the environment

Importing dynamic information

Passing arguments to shell commands

Working with Files and Packages

Introduction

Making quick edits to config files

Using Augeas to automatically edit config files

Building config files using snippets

Using ERB templates

Using array iteration in templates

Using GnuPG to encrypt secrets

Installing packages from a third-party repository

Building packages automatically from source

Comparing package versions

Users and Virtual Resources

Introduction

Using virtual resources

Managing users with virtual resources

Managing users' SSH access

Managing users' customization files

Efficiently distributing cron jobs

Using schedules to limit when resources can be applied

Using host resources

Using multiple file sources

Distributing directory trees

Cleaning up old files

Auditing resources

Temporarily disabling resources

Applications

Introduction

Managing Apache servers

Creating Apache virtual hosts

Creating Nginx virtual hosts

Managing MySQL

Managing Ruby

Servers and Cloud Infrastructure

Introduction

Building high-availability services using Heartbeat

Managing NFS servers and file shares

Using HAProxy to load-balance multiple web servers

Managing firewalls with iptables

Managing EC2 instances

Managing virtual machines with Vagrant

External Tools and the Puppet Ecosystem

Introduction

Creating custom facts

Adding external facts

Setting facts as environment variables

Importing configuration data with Hiera

Storing secret data with hiera-gpg

Generating manifests with puppet resource

Generating manifests with other tools

Testing your manifests with rspec-puppet

Using public modules

Using an external node classifier

Creating your own resource types

Creating your own providers

Creating your own functions

Monitoring, Reporting, and Troubleshooting

Introduction

Doing a dry run

Logging command output

Logging debug messages

Generating reports

Producing automatic HTML documentation

Drawing dependency graphs

Understanding Puppet errors

Inspecting configuration settings

Index