Chef is an open source configuration management tool designed to automate configurations and operations of a network and server environment.

Chef is written in Ruby and Erland. Writing code within Chef is done in Ruby.

Configuration management tools function in two different types of models, push or pull.

Push models push configuration from a centralised tool or management server, pull models check in with the server to see if there is any change in the configuration, and if there is, pulls the updated configuration to the end device.

Chefs structure, terminology and core components are different from those of Puppet.

Chef leverages a similar client/server functionality to Puppet though.

Chef ComponentsPuppet ComponentsDescription
Chef ServerPuppet MasterServer/Master
Chef ClientPuppet AgentClient/Agent Functions
CookbookModuleCollection of code or files
RecipeManifestCode being deployed to make configuration changes
WorkstationPuppet ConsoleUsers interact with configuration management tools and create code
Puppet and Chef Comparison

Code is created on the Chef work station.

The code is stored in a file called a recipe

Once a receipe is created on the workstation, it is uploaded to the Chef server to be used in an ernvironment.

Knife is the name of the command line tool used to upload cookbooks to the Chef server.

The command used is knife upload <cookbook-name>

The chef server can be hosted locally on the workstation, or remotely on a server.

There are four types of Chef server deployments:

  • Chef Solo – Hosted locally
  • Chef Client and Server – Typical Chef Deployment with distributed components
  • Hosted Chef – Chef server is hosted in the cloud
  • Private Chef – All Chef components are in the same enterprise network

All cookbooks are stored on the Chef server

The server also holds are the tools required to transfer the configurations to the Chef Clients.

OHAI, a server installed on the nodes, is used to collect the current state of a node to send the information back to the Chef server through the Chef client service.

The chef server checks if there is any new configuration that needs to be sent to the node by comparing the information from the OHAI server to the cookbook or recipe.

The Chef client service that runs on the nodes is responsible for all the communications to the Chef server.

When a node needs a recipe, the Chef client will handle the communication back to the Chef server to signify the nodes need for an updated configuration or recipe.

Because nodes can be unique or identical, the recipes can be the same or different for each note.

Recipe files have the the file extension .rb

The kitchen is where all recipes and cookbooks can be automatically executed and tested prior to going live on any production nodes.

The kitchen allows for not only testing within the enterprise environment but within many cloud providers and virtualisation technologies.

The kitchen supports many of the common testing frameworks used by the Ruby community:

  • Bash Automated Testing System (BATs)
  • Minitest
  • RSpec
  • Serverspec




Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.