Book description
Learn Chef Provisioning like a boss and discover how to deploy software and manage hosts, along with engaging recipes to automate your cloud and server infrastructure with Chef.
About This Book
Leverage the power of Chef to transform your infrastructure into code to deploy new features in minutes
Get step-by-step instructions to configure, deploy, and scale your applications
Master specific Chef techniques to run an entire fleet of machines without breaking a sweat.
Who This Book Is For
If you are a system administrator, Linux administrator, a cloud developer, or someone who just wants to learn and apply Chef automation to your existing or new infrastructure, then this learning path will show you all you need to know. In order to get the most out of this learning path, some experience of programming or scripting languages would be useful.
What You Will Learn
Install Chef server on your own hosts
Integrate Chef with cloud services
Debug your cookbooks and Chef runs using the numerous inspection and logging facilities of Chef
Extend Chef to meet your advanced needs by creating custom plugins for Knife and Ohai
Create a perfect model system
Use the best test-driven development methodologies
In Detail
Chef is a configuration management tool that turns IT infrastructure into code. Chef provides tools to manage systems at scale. This learning path takes you on a comprehensive tour of Chef's functionality, ranging from its core features to advanced development. You will be brought up to speed with what's new in Chef and how to set up your own Chef infrastructure for individuals, or small or large teams. You will learn to use the basic Chef command-line tools. We will also take you through the core concepts of managing users, applications, and your entire cloud infrastructure. You will learn the techniques of the pros by walking you through a host of step-by-step guides to solve real-world infrastructure automation challenges.You will learn to automate and document every aspect of your network, from the hardware to software, middleware, and all your containers. You will become familiar with the Chef'sProvisioning tool. By the end of this course, you will be confident in how to manage your infrastructure, scale using the cloud, and extend the built-in functionality of Chef itself.The books used in this Learning Path are:
1) Chef Essentials
2) Chef Infrastructure Automation Cookbook – Second Edition
3) Mastering Chef Provisioning
Style and approach
This fast-paced guide covers the many facets of Chef and will teach administrators to use Chef as a birds-eye lens for their entire system. This book takes you through a host of step-by-step guides to solve real-world infrastructure automation challenges and offers elegant, time-saving solutions for a perfectly described and automated network.
Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.
Table of contents
-
Chef: Powerful Infrastructure Automation
- Table of Contents
- Chef: Powerful Infrastructure Automation
- Chef: Powerful Infrastructure Automation
- Credits
- Preface
-
1. Module 1
- 1. Installing Chef
- 2. Modeling Your Infrastructure
- 3. Integrating with the Cloud
- 4. Working with Cookbooks
- 5. Testing Your Recipes
-
6. From Development to Deployment
- Describing the setup
- Deploying software with Chef
- Configuring your local environment
- Modeling a simple Python application
-
Managing the cookbooks
- Downloading cookbooks
- Looking at the database recipe
- Looking at your application deployment cookbook
- Preparing the directories
- Constructing your Python virtual environment
- Checking the source code
- Installing any extra dependencies
- Using Python's requirements file
- Configuring your application
- Keeping your application running
- Defining roles
- Adding users
- Provisioning EC2 instances
- Configuring the web server
- Deploying your software
- Summary
- 7. Beyond Basic Recipes and Cookbooks
-
8. Extras You Need to Know
- Vagrant and Chef-solo
- Getting to know the Chef shell
- Integration testing
- Extending Chef
- Automation and integration
- Summary
-
2. Module 2
-
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
-
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
-
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
-
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
-
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 (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
-
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
-
1. Chef Infrastructure
-
3. Module 3
- 1. Setting Up a Development Environment on Your Workstation
- 2. Knife Tooling and Plugins
- 3. Leveraging Roles, Environments, and Policies
- 4. Custom Resources
-
5. Provisioning in the Traditional Data Center
- VMware provisioning
-
OpenStack provisioning
- Setting up a DevStack OpenStack all-in-one environment
- Deploying the DevStack Host VM
- Downloading and installing DevStack
- Downloading the demo project rc file and applying it
- Adding the security rules to allow ping and ssh traffic
- Installing the knife OpenStack plugin
- Setting up the DevStack public key
- Allocating some floating IP addresses to the project
- Configuring the knife-openstack plugin knife settings
- Adding a CentOS instance image to provision
- Provisioning a new instance
- References
- Network automation
- Summary
- 6. Provisioning in the Cloud
- 7. Test-Driven Development
- 8. Using Chef Provisioning
- A. Bibliography
- Index
Product information
- Title: Chef: Powerful Infrastructure Automation
- Author(s):
- Release date: May 2017
- Publisher(s): Packt Publishing
- ISBN: 9781788392976
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
Mastering Chef Provisioning
Learn Chef Provisioning like a boss and finally own your infrastructure About This Book This is …
book
Chef Infrastructure Automation Cookbook - Second Edition
Over 80 recipes to automate your cloud and server infrastructure with Chef and its associated toolset …
book
Azure Strategy and Implementation Guide
Leverage Azure's cloud capabilities to find the most optimized path to meet your firm's cloud infrastructure …