
Chef: Powerful Infrastructure Automation
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Persons
Earl Waud is a virtualization development professional with more than 20 year's experience developing customer-facing, enterprise-grade software for VM, and works with container provisioning, management, and automation. Earl has a proven track record of delivering on-time solutions that significantly impact business results; solutions that align engineering strategies with organizational vision. Recently, Earl has been creating AWS-based container solutions for enterprises using Docker, Kubernetes, Artifactory, Xray, and Twistlock. Currently, Earl is a senior software engineer with Intuit Inc. Other books by Earl include Mastering Chef Provisioning and Chef: Powerful Infrastructure Automation. Earl can be found online at SanDiegoEarl (dot) com.Ewart John :
John Ewart is a system architect, software developer, and lecturer. He has designed and taught courses at a variety of institutions, including the University of California, The California State University, and local community colleges. These courses cover a wide range of computer science topics, including Java, data structures and algorithms, operating systems fundamentals, Unix and Linux system administration, and web application development. In addition to working and teaching, he maintains and contributes to a number of open source projects. He currently resides in Redmond, Washington, with his wife, Mary, and their two children.Marschall Matthias :
Matthias Marschall is a Software Engineer "made in Germany". His four children make sure that he feels comfortable in lively environments, and stays in control of chaotic situations. A lean and agile engineering lead, he's passionate about continuous delivery, infrastructure automation, and all things DevOps. In recent years, Matthias has helped build several web-based businesses, first with Java and then with Ruby on Rails. He quickly grew into system administration, writing his own configuration management tool before migrating his whole infrastructure to Chef in its early days. In 2008, he started a blog (http://www.agileweboperations.com) together with Dan Ackerson. There, they have shared their ideas about DevOps since the early days of the continually emerging movement. You can find him on Twitter as @mmarschall. Matthias holds a Master's degree in Computer Science (Dipl.-Inf. (FH)) and teaches courses on Agile Software Development at the University of Augsburg. When not writing or coding, Matthias enjoys drawing cartoons and playing Go. He lives near Munich, Germany.
Content
- Cover
- Copyright
- Credits
- Preface
- Table of Contents
- Module 1: Chef Essentials
- Chapter 1: Installing Chef
- Terminology
- Working with Chef
- Installing chef-solo
- The Ruby gem
- Managing gems
- Verifying that chef-solo works
- Installing a Chef server
- Requirements and recent changes
- Installation requirements
- What you will be installing
- Getting the installer
- Installation outline
- Installing on Ubuntu
- Downloading the package
- Installing the package
- Installing on Red Hat Enterprise Linux
- Downloading the package
- Configuring a Chef server
- Understanding how chef-server-ctl works
- What's happening on my server?
- Verifying that the services are running
- Validating that your service is working
- Ensuring that your knife configuration works
- Summary
- Chapter 2: Modeling Your Infrastructure
- Getting to know Chef
- Modeling your infrastructure
- Roles
- Defining roles
- Implementing a role
- Determining which recipes you need
- Installing a cookbook
- Applying recipes to roles
- Mapping your roles to nodes
- Converging a node
- Environments
- Organizing your configuration data
- Example attribute data
- Data bags
- Knowing when to use data bags
- Large-scale infrastructure
- Summary
- Chapter 3: Integrating with the Cloud
- Leveraging the cloud
- Amazon EC2
- Installing the EC2 knife plugin
- Setting up EC2 authentication
- Provisioning an instance
- Bootstrapping the instance
- Terminating the instance
- Removing the Chef node
- Rackspace Cloud
- Provisioning an instance
- Terminating an instance
- Removing the Chef node
- Summary
- Chapter 4: Working with Cookbooks
- Attributes
- Multiple attribute files
- Supporting multiple platforms
- Loading external attributes
- Using attributes
- Metadata
- Recipes
- Resources
- Using resources
- Overriding a default behavior
- Templates
- Why use templates?
- A quick ERB primer
- The template resource
- The template variables
- Passing variables to a template
- Accessing computed configurations
- Searching for templates
- Definitions
- Recipes
- Developing recipes
- Writing recipes
- Starting out small
- Installing a simple service
- Getting more advanced
- Summary
- Chapter 5: Testing Your Recipes
- Testing recipes
- RSpec
- RSpec and ChefSpec
- Testing basics
- Comparing RSpec with other testing libraries
- Using ChefSpec
- Getting started with ChefSpec
- Installing ChefSpec
- Locking your dependencies in Ruby
- Creating a simple recipe and a matching ChefSpec test
- Writing a ChefSpec test
- Building your recipe
- Executing tests
- Understanding failures
- Expanding your tests
- Multiple examples in a spec test
- Testing for multiple platforms
- Summary
- Chapter 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
- Managing dependencies in Chef
- Managing dependencies elsewhere
- Using Python's requirements file
- Configuring your application
- Keeping your application running
- Defining roles
- Creating the base server role
- Creating the database server role
- Creating the web server role
- Adding users
- Provisioning EC2 instances
- Configuring the database host
- Configuring the web server
- Deploying your software
- Manually deploying updates
- Automating deployment
- Summary
- Chapter 7: Beyond Basic Recipes and Cookbooks
- Managing users
- Evolution of a shell user recipe
- Storing data in data bags
- Creating a data bag for users
- Searching for data
- Searching inside recipes
- Enhancing your user cookbook
- Distributing SSH keys
- Templating the authorized keys
- Adding deployment keys
- Writing custom extensions
- Developing a custom definition
- Organizing your code
- Writing a definition for using PIP
- Defining a full application template
- Building a resource
- Defining the resource
- Implementing the provider
- Modifying resources
- Loading an existing resource
- Declaring that a resource was updated
- Working with data bags
- Securing your data bags
- Secret keys
- Encrypting your data
- Decrypting your data
- Storing keys on nodes
- Searching your data
- Searching your data bags with knife
- Searching your data bags from a recipe
- Querying your data
- Managing multiple machines with search queries
- Summary
- Chapter 8: Extras You Need to Know
- Vagrant and Chef-solo
- Installing Vagrant
- Provisioning a new host with Vagrant
- Booting your Vagrant image
- Combining Vagrant with Chef-solo
- Understanding the limitations of Chef-solo
- Configuring Chef-solo
- Telling Chef-solo what to run
- Using roles and data bags with Chef-solo
- Getting to know the Chef shell
- Using the Chef shell
- The standalone mode
- The solo mode
- The client mode
- Interacting with the Chef server using the shell
- Interacting with data
- Searching your data
- Editing your data
- Transforming data
- Executing recipes with Chef shell
- Creating a recipe in the shell
- Defining node attributes
- Using configuration blocks
- Interactively executing recipes
- Debugging with the Chef shell
- Using the breakpoint resource
- Integration testing
- Using Test Kitchen
- Installing Test Kitchen
- Testing with Test Kitchen
- Extending Chef
- Writing an Ohai plugin
- A note about writing Ohai plugins
- Chef with Capistrano
- Automation and integration
- Automated updates and deployments
- Summary
- Module 2: Chef Infrastructure Automation Cookbook - Second Edition
- Chapter 1: Chef Infrastructure
- Introduction
- Using version control
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Installing the Chef development kit on your workstation
- How to do it...
- How it works...
- See also
- Using the hosted Chef platform
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing virtual machines with Vagrant
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating and using cookbooks
- Getting ready
- How to do it...
- How it works...
- See also
- Inspecting files on your Chef server with knife
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Defining cookbook dependencies
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing cookbook dependencies with Berkshelf
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Downloading and integrating cookbooks as vendor branches into your Git repository
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using custom knife plugins
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Deleting a node from the Chef server
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Developing recipes with local mode
- Getting ready
- How to do it...
- How it works...
- There's more...
- Running knife in local mode
- Moving to hosted Chef or your own Chef server
- See also
- Using roles
- Getting ready
- How to do it...
- How it works...
- See also
- Using environments
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Freezing cookbooks
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Running Chef client as a daemon
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using chef-shell
- How to do it...
- How it works...
- There's more...
- See also
- Chapter 2: Evaluating and Troubleshooting Cookbooks and Chef Runs
- Introduction
- Testing your Chef cookbooks
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Flagging problems in your Chef cookbooks
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Test-driven development for cookbooks using ChefSpec
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Integration testing your Chef cookbooks with Test Kitchen
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Showing affected nodes before uploading cookbooks
- Getting ready
- How to do it...
- How it works...
- See also
- Overriding a node's run list to execute a single recipe
- Getting ready
- How to do it...
- How it works...
- See also
- Using why-run mode to find out what a recipe might do
- Getting ready
- How to do it...
- How it works...
- See also
- Debugging Chef client runs
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Inspecting the results of your last Chef run
- Getting ready
- How to do it...
- How it works...
- See also
- Raising and logging exceptions in recipes
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Diff-ing cookbooks with knife
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using community exception and report handlers
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating custom handlers
- Getting ready...
- How to do it...
- How it works...
- There's more...
- See also
- Chapter 3: Chef Language and Style
- Introduction
- Using community Chef style
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using attributes to dynamically configure recipes
- Getting ready
- How to do it...
- How it works...
- There's more...
- Calculating values in the attribute files
- See also
- Using templates
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Mixing plain Ruby with Chef DSL
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Installing Ruby gems and using them in recipes
- Getting ready
- How to do it...
- How it works...
- See also
- Using libraries
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using definitions
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating your own Lightweight Resource Providers (LWRP)
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Extending community cookbooks by using application wrapper cookbooks
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating custom Ohai plugins
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating custom knife plugins
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Chapter 4: Writing Better Cookbooks
- Introduction
- Setting the environment variables
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Passing arguments to shell commands
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Overriding attributes
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using search to find nodes
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using knife to search for nodes
- Searching for arbitrary node attributes
- Using Boolean operators in search
- See also
- Using data bags
- Getting ready
- How to do it...
- How it works...
- See also
- Using search to find data bag items
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using encrypted data bag items
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using a private key file
- See also
- Accessing data bag values from external scripts
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Getting information about the environment
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Writing cross-platform cookbooks
- Getting ready
- How to do it...
- How it works...
- There's more...
- Avoiding case statements to set values based on the platform
- Declaring support for specific operating systems in your cookbook's metadata
- See also
- Finding the complete list of operating systems you can use in cookbooks
- How to do it...
- How it works...
- There's more...
- See also
- Making recipes idempotent by using conditional execution
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Chapter 5: Working with Files and Packages
- Introduction
- Creating configuration files using templates
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using pure Ruby in templates for conditionals and iterations
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Installing packages from a third-party repository
- Getting ready
- How to do it...
- How it works...
- See also
- Installing software from source
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Running a command when a file is updated
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Distributing directory trees
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Cleaning up old files
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Distributing different files based on the target platform
- Getting ready
- How to do it...
- How it works...
- See also
- Chapter 6: Users and Applications
- Introduction
- Creating users from data bags
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Securing the Secure Shell Daemon (SSHD)
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Enabling passwordless sudo
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing NTP
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing nginx
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating nginx virtual hosts
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating MySQL databases and users
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing WordPress sites
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing Ruby on Rails applications
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing Varnish
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing your local workstation
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Chapter 7: Servers and Cloud Infrastructure
- Introduction
- Creating your infrastructure using Chef Provisioning
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Creating cookbooks from a running system with Blueprint
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Running the same command on many machines at once
- How to do it...
- How it works...
- There's more...
- See also
- Setting up SNMP for external monitoring services
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Deploying a Nagios monitoring server
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Building high-availability services using heartbeat
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Using HAProxy to load-balance multiple web servers
- Getting ready
- How to do it...
- How it works...
- See also
- Using custom bootstrap scripts
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing firewalls with iptables
- Getting ready
- How to do it...
- How it works...
- See also
- Managing fail2ban to ban malicious IP addresses
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Managing Amazon EC2 instances
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Loading your Chef infrastructure from a file with spiceweasel and knife
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Module 3: Mastering Chef Provisioning
- Chapter 1: Setting Up a Development Environment on Your Workstation
- Re-introducing Chef
- What version of the Chef tools do I use?
- References
- Filling in the gaps in your Chef knowledge base
- Major pieces of a Chef puzzle
- The Chef client
- The Ohai Chef tool
- Recipes and cookbooks
- Chef run lists
- Chef roles
- Chef resources
- More things to consider
- Data bags
- Environments
- The Chef supermarket
- Chef Development Kit
- Setting up an on-premise (private) Chef Server
- References
- Exploring the Chef Development Kit
- The Chef Knife
- Community tools
- References
- Installing Chef Development Kit
- Downloading ChefDK
- Installing ChefDK
- Verifying ChefDK
- References
- Setting up a standard Chef repo
- Using the Chef tool for Chef repo
- The repo starter kit
- Files for your .chef folder - a safer way
- Growing your own tree
- Self-signed certificates
- References
- What else do you need?
- Using your favorite editor
- Version control systems
- Virtualization hypervisor
- Vagrant
- References
- What is chef-apply?
- Why is that useful?
- References
- Summary
- Chapter 2: Knife Tooling and Plugins
- Knife help
- References
- Knife subcommands
- Knife Bootstrap
- Knife Node
- Knife Diff
- Knife Exec
- Knife SSH
- Knife Search
- References
- Knife to editor integration
- Using the "wait" option
- Does my editor require the wait option?
- References
- Knife Windows plugin
- Installing the Knife Windows plugin
- Bootstrapping a Windows node
- Searching for Windows node data
- References
- Knife EC2 plugin
- Installing the Knife EC2 plugin
- Creating an EC2 instance
- Bootstrapping an existing EC2 instance
- Deleting EC2 instances
- References
- Creating new Knife plugins
- The basic plugin file format
- Example - A simpler EC2 Create Server plugin
- References
- Summary
- Chapter 3: Leveraging Roles, Environments, and Policies
- Using Chef roles
- How to create a role
- Using per-environment run-lists in roles
- Using nested roles
- There is a downside to roles
- References
- Using Chef environments
- The _default environment
- Creating environments
- Specifying cookbook versions in environments
- References
- Using Chef organizations
- Creating organizations
- Access control
- References
- Learning the attribute precedence hierarchy
- Understanding attribute precedence factors
- Resulting precedence hierarchy
- Exploring policies
- What exactly is a policy?
- Why would I use a policy?
- How do I use a policy?
- Another example
- How to specify the source options for cookbooks
- What are the "Gotchas"?
- References
- Summary
- Chapter 4: Custom Resources
- Out with the old (LWRPs), in with the new (Custom Resources)
- What is the difference between the old way and the new way of defining resources?
- What is a Custom Resource?
- References
- Creating an example use case
- What is the goal?
- Creating the cookbook
- Creating the default recipe
- The recipe worked, but what is missing?
- References
- Creating and using a Custom Resource
- What makes up a Custom Resource?
- Creating the "website" Custom Resource
- Using our Custom Resource
- References
- Making a Custom Resource more reusable
- Making a Custom Resource-only cookbook
- Reuse the code from the "mywebapp" example
- Using the reusable Custom Resource-only cookbook
- Handling idempotence
- References
- Subclassing a Custom Resource
- Convert our resource into a library module
- Subclassing the library module Custom Resource
- References
- Summary
- Chapter 5: Provisioning in the Traditional Data Center
- VMware provisioning
- Installing the knife-vsphere plugin
- Provisioning VMs using the knife-vsphere plugin
- Cleaning up our vSphere and Chef environments
- Using Chef with VMware and Vagrant
- References
- 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
- Automating juniper devices
- Automating Cisco systems
- Automating F5 LTMs
- References
- Summary
- Chapter 6: Provisioning in the Cloud
- Provisioning AWS EC2 instances
- Understanding EC2 authentication
- Creating key pairs
- Creating security groups
- Installing Chef Server into an EC2 instance
- References
- Provisioning Microsoft Azure instances
- Installing the knife-azure plugin
- Configuring the plugin
- Verifying the configuration
- Generating public/private key pairs
- Provisioning virtual machines
- Provisioning a new Chef server into Azure
- References
- Provisioning in the Google Cloud platform
- Installing and configuring the knife-google plugin
- Creating and registering your key pairs
- Provisioning virtual machines with the GCE
- Deploying Chef server into a GCE instance
- References
- Looking at an honorable mention - Linode
- References
- Provisioning containers in Docker
- Setting up a Docker server to host our containers
- Installing and using Docker on our Chef Workstation
- Using the knife-docker plugin
- References
- Summary
- Chapter 7: Test-Driven Development
- Analyzing cookbooks with RuboCop
- Using RuboCop
- Examining the RuboCop output
- Customizing RuboCop
- References
- Analyzing cookbooks with Foodcritic
- Using Foodcritic
- Examining the Foodcritic output
- Customizing Foodcritic
- References
- Unit testing with ChefSpec
- Using ChefSpec
- Expanding our tests
- References
- Integration testing with Kitchen and ServerSpec
- Preparing our tests
- Kitchen create
- Kitchen converge
- Kitchen verify
- References
- Summary
- Chapter 8: Using Chef Provisioning
- What is Chef provisioning?
- It's highly idempotent
- A hypothetical example
- References
- How to use Chef Provisioning
- Chef Provisioning resources
- A Vagrant example
- A cloud example with AWS
- A Docker example
- References
- Summary
- Index
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.