How I’m Learning Chef Configuration Management

A Beginner's Guide to Chef

What is Chef?

Chef is a configuration management tool. Configuration management tools are used in DevOps to help create powerful systems that enable continuous deployment. Configuration management tools like Chef manage certain entities like infrastructure and code.

How is it useful for DevOps?

Configuration management tools are useful in DevOps because they allow for quick fixes and configuration changes for servers. Rather than updating tens or hundreds of servers with a few lines of code, Chef allows you to write code once and deploy to as many servers as you need. This is a critical point for efficient continuous deployment.

How does Chef work?

Chef is set up with 3 different points of architecture. There’s the Workstation, the Server, and the Nodes. Each one plays a specific role in how your whole system gets the configurations it needs to keep deployments continuous.

But before we dive into the architecture, it’s important to understand the file structure of Chef. Chef at its core is written in Ruby and Erlang, but all the configurations you will end up writing will be in Ruby. These configuration files are called recipes. A collection of recipes is called a cookbook.

Now, back to the architecture.

The Workstation is your computer or the computer you might have remote access/ssh access to. This is the place where the recipes and cookbooks are updated and deployed with Chef’s CLI tool knife. Knife pushes your changes to the Server.

The Server is responsible for holding the source of truth for all the Nodes. So it contains the finished recipes and cookbooks that you have deployed to it. It won't contain any new changes or updates until you deploy those from your Workstation to the Server.

The Nodes are the individual servers that are running your services or applications. These Nodes use a tool called OHAI to check their state against the Server. If there is a difference in the state between the Nodes and the Server, chef-client is used to update the Nodes with whatever changes are needed from the Server. Oftentimes chef-client is set up with cron to run at a certain time every day or at certain time intervals, like every 30 minutes.

How am I learning Chef?

I used this video to understand what Chef is and how I can start using Chef today:

Additionally, since Chef recipes are written in Ruby, I’m taking this course on the basics of Ruby:

Additional Resources

https://docs.chef.io/chef_overview/