Using Chef to Manage Your Server Environments

Comments

Comments are closed.

Great introduction to Chef

Comments thanks to Mark Marsiglio:

Note that Chef has just released a new version.


Managing Servers with Chef
Joe Kepley, Blend Interactive

DevOps = Development + Operations, Combine IT Operations with Development and QA functions. How can we use some of the automation and tools we develop to manage our own infrastructure?

Build a new server 1) Manually, 2) with build scripts (limited to a particular type of server and function, hard to maintain), 3) Chef - tell the computer what it should do and how it should do it
Chef and Puppet are two tools, use a DSL to define how they work.
What is Chef
Talk about the end-state desired, not the method of doing it
Idempotent - rerun script only changes, does not redo everything again
Use Recipes, Cookbooks, Attributes and Data Bags
Apache Cookbook knows what is required to configure Apache on a particular OS
Includes templates (recipes) for how things should be set up
Accepts Attributes as variables to insert into the templates
Use a Role or Environment to define an override for Attribute
Data Bags contain things like user-specific settings, keys, privileges, etc
Chef Server - stores all of the configs
Chef Client - runs on the web servers to stay in sync,
Ohai - extracts information about servers to give to Chef
Knife - command line for using chef - "create an ec2 server in this region of this size with these packages for this role with these options"
Chef Solo - Good for testing
Hosted Chef - has more options than the open source version
Git - Knife maintains cookbooks in a git repo, branches and merges as needed, but Chef Server does not talk to Git
Solr backed - query against the database for variables, such as querying the IP of a server in a script (search for a server with a role of MySQL and insert that IP here)
Development Cycle - Create cookbook, declare recipes, Chef looks for the resource to create the user (it knows to use the adduser command, for instance, and knows to edit if the user is already there)
Upload the cookbook to the Chef server
Execute on client servers
Berkshelf - dependency management, calculates dependencies for cookbooks and uploads them to the target as needed
Vagrant - automated testing environments, works with Virtualbox to give a destroyable test environment


Looks like the new version (chef 11) is very compatible with chef 10 and mostly provides some handy new bootstrap scripts (chef-apply) and adds some new tools for recipe developers.