This content is part of the Essential Guide: Modern data center strategy: Design, hardware and IT's changing role

An Opscode Chef tutorial for beginners

To use Chef in the data center, you'll find your administrator mind-set gradually opening up to the developer way of thinking. These tips and resources will accelerate the process.

As with any new technology, your first test deployment of Chef isn't one you are likely to roll right into production.

You're starting from scratch, things change and you don't have any sort of standard deployment model to work from because DevOps is new. It all starts in the lab; the design and processes you establish there will mold the eventual production deployment. Address these issues early to get Opscode Chef instances on the right track.

This beginner's Opscode Chef tutorial includes general tips and troubleshooting tricks that will accelerate your "kitchen" skills.

Chef for the administrator

The more we talk about Chef, the more it seems we're fostering a developer-like skill set. To use tools like Chef, we're going to need to step a little out of our administrator or engineer comfort zone.

You first create Chef configuration files on the tool's management station, and then upload these files to the Chef server, where clients process them. This repository of configuration files is referred to as the chef-repo.

Give the file structure of the chef-repo a base layout. Opscode has a downloadable baseline chef-repo file structure on its GitHub page, which is a good starting point. Learn the structure of the repo -- it gives you an idea of how to structure your environment and includes helpful readme files.

With a base file structure, start creating all the Chef constructs needed to automate your environment. These constructs will change as you automate more and more areas over time.

Version control is an absolute must for your chef-repo. You likely won't be the only one on the IT team making changes to Chef. Pick a version control system, such as Git and GitHub, and get comfortable using it immediately. Version control attributes each change to the responsible administrator as well as tracking versions and changes.

Cook outside of your comfort zone

The more we talk about Chef, the more it seems we're fostering a developer-like skill set. To use tools like Chef, we're going to need to step a little out of our administrator or engineer comfort zone.

Chef is written in Ruby and Erlang, but that doesn't mean that you need to know Ruby to use it. Users write recipes in the Chef domain specific language (DSL). While Opscode designed the DSL to be easy to learn, any new coding language can be a challenge. Reach out to the Chef community, which shares hundreds of recipes and cookbooks to use as examples. The Chef Supermarket holds hundreds of community-built and -supported cookbooks to copy or emulate.

When you get started making your own cookbooks and recipes, there's a good chance that you'll face configuration issues that cause Chef not to run properly. There's a basic troubleshooting methodology to narrow down the cause. First, run the chef-client with an empty run list to see if the issue lies with your associated cookbooks or recipes, or with the chef-client configuration that runs on the nodes. If the failure ceases with the empty run list, the problem is in your cookbook or recipe. If it persists with the empty run list, check your configuration for client-to-server communication issues. Also verify that the Chef components have permission to run on each host.

The Chef community is huge and there are hundreds of examples out there to get you started. There are also lots of helpful people in the community, so look to them for assistance to further your Opscode Chef training. As you gain skills, you can contribute for other newcomers.

About the author:
Jon Langemak is a network engineer at a Minnesota-based corporation. He works primarily on Cisco network solutions but enjoys dabbling in other fields as well. Langemak is currently a CCNP/IP working towards the CCIE. IT is also his hobby, and he runs the blog Das Blinken Lichten to document new technologies and testing concepts.

Next Steps

Check out how Facebook's IT team uses Chef

Hear from Chef veterans at Web businesses

Inside a six-person, 1,000 server deployment

Dig Deeper on Configuration Management and DevOps