Introduction to Chef

When I started working for my current employer, I had experience with CFEngine2 and a dabbling in Puppet. Unfortunately for me, my new job used Chef. I thought I'd give myself an opportunity to learn it better by using it to configure my server and laptop at home. But I was in a hurry to get things configured and ended up using something that I perceived as having a shorter start time. Would that I had taken Nathen Harvey's CHef training sooner.

Harvey lead the day-long class through a simple example that demonstrated many of the basic Chef operations. Chef is an open source configuration management tool designed to enable infrastructure automation. Based around the idea of infrastructure as code, Chef allows the admin to rebuild the infrastructure with only backups of data, compute resources, and the code repository. Chef allows self-hosted or hosted installations that can be divided by "organizations", allowing different departments, business units, or even companies to use the same Chef infrastructure.

Chef can manage many aspects of a system, including networking, files, users, groups, etc. The desired state is declared in the Chef configuration, with the admin focusing on what needs to be done, and Chef worries about how to do it. In addition, Chef has a tool called "Ohai" that collects information about a machine. The Chef server stores information about nodes, enabling attribute-based search. This makes it possible for, as an example, load balancers to know what web servers to connect to.

Chef has a large thematically-appropriate vocabulary. The admin uses a tool called "knife" to interact with Chef. "Recipes" define the desired configuration. A "cookbook" is a collection of recipes that also include other information necessary to implement the desired states, including templates, files, libraries, and so on.

The course took attendees through the process of bootstrapping Chef onto a node and configuring it as a web server. Once the initial "hello world" site was setup, multiple virtual hosts based on a common Chef-managed template were created.

Harvey took the class through the process of a chef-client run. He explained the authentication mechanisms used by Chef. Finally, he sprinkled "all the Ruby you'll need to know to use Chef" through the day. Now that I've sat through this course, I might take another stab at Cheffing up my home infrastructure.