Book description
Master over 80 incredibly effective recipes to manage the day-to-day complications in your infrastructure
About This Book
Immediately apply Devops techniques and methods, then combine them with powerful Chef tools to manage and automate your infrastructure
Address the growing challenges of code management, cloud, and virtualization with Chef quickly
Explore and implement the important aspects of Chef Automate using this recipe-based guide
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 is also for DevOps Engineers, IT professionals, and organizations who want to automate and gain greater control of their infrastructures with Chef. No experience with Chef is needed, but may help.
What You Will Learn
Test your cookbooks with Test Kitchen
Manage cookbook dependencies with Berkshelf
Use reporting to keep track of what happens during the execution of chef-client runs across all of the machines
Create custom Ohai and Knife plugins
Build a high-availability service using Heartbeat
Use a HAProxy to load-balance multiple web servers
In Detail
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 will help you solve everyday problems with your IT infrastructure with Chef. It will start with recipes that show you how to effectively manage your infrastructure and solve problems with users, applications, and automation. You will then come across a new testing framework, InSpec, to test any node in your infrastructure.
Further on, you will learn to customize plugins and write cross-platform cookbooks depending on the platform. You will also install packages from a third-party repository and learn how to manage users and applications. Toward the end, you will build high-availability services and explore what Habitat is and how you can implement it.
Style and approach
This book follows a recipe-based approach and covers all the important topics you need to know. If you don't want to dig through a whole book before you get started, this book is for you, as it features a set of independent recipes you can try out immediately.
Table of contents
-
Chef Cookbook - Third Edition
- Table of Contents
- Chef Cookbook - Third Edition
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
-
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
- How to do it…
- How it works…
- There's more…
- See also
- Defining cookbook dependencies
- Managing cookbook dependencies with Berkshelf
- Using custom knife plugins
- Deleting a node from the Chef server
- Developing recipes with local mode
- Using roles
- Using environments
- Freezing cookbooks
- Running the Chef client as a daemon
-
2. Evaluating and Troubleshooting Cookbooks and Chef Runs
- Introduction
- Testing your Chef cookbooks with cookstyle and Rubocop
- Flagging problems in your Chef cookbooks with Foodcritic
- Test-driven development for cookbooks using ChefSpec
- Compliance testing with InSpec
- 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 chef-shell
- Using why-run mode to find out what a recipe might do
- Debugging Chef client runs
- Inspecting the results of your last Chef run
- Using Reporting to keep track of all your Chef client runs
- Raising and logging exceptions in recipes
- Diff-ing cookbooks with knife
- Using community exception and report handlers
-
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
- Creating your own custom resource
- Extending community cookbooks by using application wrapper cookbooks
- Creating custom Ohai plugins
- Creating custom knife plugins
-
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
- Making recipes idempotent by using conditional execution
-
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
-
6. Users and Applications
- Introduction
- Creating users from data bags
- Securing the Secure Shell daemon
- Enabling passwordless sudo
- Managing NTP
- Installing nginx from source
- Creating nginx virtual hosts
- Creating MySQL databases and users
- Managing Ruby on Rails applications
- Managing Varnish
- Managing your local workstation with Chef Pantry
-
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
- 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
- Managing applications with Habitat
- Index
Product information
- Title: Chef Cookbook - Third Edition
- Author(s):
- Release date: February 2017
- Publisher(s): Packt Publishing
- ISBN: 9781786465351
You might also like
book
Automation through Chef Opscode
Automation through Chef Opscode provides an in-depth understanding of Chef, which is written in Ruby and …
book
Chef Infrastructure Automation Cookbook - Second Edition
Over 80 recipes to automate your cloud and server infrastructure with Chef and its associated toolset …
video
Chef Fundamentals: A Recipe for Automating Infrastructure
Are you the only Chef in the kitchen? Is your infrastructure suffering from snowflake servers? Are …
article
Twenty Years of Open Innovation
Organizations that practice open innovation draw on external resources to develop new ideas for products and …