Get started Bring yourself up to speed with our introductory content.

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

This was last published in January 2015

PRO+

Content

Find more PRO+ content and other member only offers, here.

Essential Guide

An initiation into infrastructure automation tools and methods

Join the conversation

4 comments

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What's your favorite community or resource for troubleshooting IT problems?
Cancel
I don’t really have one particular favorite community for troubleshooting IT problems. It’s really more specific to the problem. If it’s something related to Perl scripting, I’m likely to go to perlmonks.org, whereas something that relates more to software testing I’ll ask on Twitter to get help from the online testing community.
Cancel
I'm partial to this one for most issues. For some others, depending on the software I use that vendors forums, like Unity and Blender for 3D modeling and gaming development. 
Cancel
Our approach was, when we first started using Chef, to just implement something that worked. It didn’t have to be pretty or elegant, it just had to work as a proof of concept. Later, once we had proven that we could use Chef to do what we needed to done, we developed the elegant solution that was eventually rolled into production. Note that the chef-repo has been deprecated, and Opscode now recommends using the chef generate repo that comes with the Chef Development Kit.
Cancel

-ADS BY GOOGLE

SearchDataCenter

SearchAWS

SearchServerVirtualization

SearchCloudApplications

SearchCloudComputing

DevOpsAgenda

Close