Free Sample
+ Collection

Chef Infrastructure Automation Cookbook

Cookbook
Matthias Marschall

For systems administrators and developers this book could revolutionize your cloud and server infrastructure through automation. Packed with real world situations and practical recipes, it’s a dazzling insight into Chef.
$26.99
$44.99
RRP $26.99
RRP $44.99
eBook
Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849519229
Paperback276 pages

About This Book

  • Configure, deploy, and scale your applications
  • Automate error prone and tedious manual tasks
  • Manage your servers on-site or in the cloud
  • Solve real world automation challenges with task-based recipes
  • The book is filled with working code and easy-to-follow, step-by-step instructions

Who This Book Is For

This book is for system engineers and administrators who have a fundamental understanding of information management systems and infrastructure. It helps if you've already played around with Chef; however, the book covers all the important topics you will need to know. If you don't want to dig through a whole book before you can get started, this book is for you, as it features a set of independent recipes you can try out immediately.

Table of Contents

Chapter 1: Chef Infrastructure
Introduction
Using version control
Installing Chef 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
Changing organizations based on the current Git branch
Deleting a node from the Chef Server
Running Chef Solo
Using roles
Using environments
Freezing cookbooks
Running Chef Client as a daemon
Using the Chef console (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 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 results of your last ChefClient run
Raising and logging exceptions in recipes
Diffing 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 Light Weight 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 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 sites
Creating MySQL databases and users
Managing WordPress sites
Managing Ruby on Rails applications
Managing Varnish
Managing your workstation
Chapter 7: Servers and Cloud Infrastructure
Introduction
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

  • Define your infrastructure as code with Chef
  • Set up your local development and testing environment for Chef with cookbooks and Vagrant
  • Debug your cookbooks and Chef runs by using the numerous inspection and logging facilities of Chef
  • Write clean and maintainable cookbooks by following established coding standards and patterns
  • Drive your cookbooks from external data or node specific attributes by using data bags and search
  • 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 using Chef's testing infrastructure

In Detail

Irrespective of whether you're a systems administrator or a developer, if you're sick and tired of repetitive manual work and not knowing whether you may dare to reboot your server, it's time for you to get your infrastructure automated.

Chef Infrastructure Automation Cookbook has all the required recipes to configure, deploy, and scale your servers and applications, irrespective of whether you manage 5 servers, 5,000 servers, or 500,000 servers.

Chef Infrastructure Automation Cookbook is a collection of easy-to-follow, step-by-step recipes showing you how to solve real-world automation challenges. Learn techniques from the pros and make sure you get your infrastructure automation project right the first time.

Chef Infrastructure Automation Cookbook takes you on a journey through the many facets of Chef. It teaches you simple techniques as well as fully fledged real-world solutions. By looking at easily digestible examples, you'll be able to grasp the main concepts of Chef, which you'll need for automating your own infrastructure. Instead of wasting time trying to get existing community cookbooks running in your environment, you'll get ready made code examples to get you started.

After describing how to use the basic Chef tools, the book shows you how to troubleshoot your work and explains the Chef language. Then, it shows you how to manage users, applications, and your whole cloud infrastructure. The book concludes by providing you additional, indispensable tools and giving you an in-depth look into the Chef ecosystem.

Chef Infrastructure Automation Cookbook 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.

Authors

Read More