Similar to OpenStack, Chef is a tool that brings technologies used by web-scale companies to the mainstream. OpenStack enables us to dynamically deploy thousands of virtual machine instances. Chef enables the automated configuration of those instances and is inspired by the automation long used at both Amazon and Google. Chef has become one of the more popular configuration management tools and cloud services like Amazon OpsWorks support Chef. Alternatives to Chef are Puppet, Ansible and Salt.
Chef provides a way to code infrastructure in “recipes”. The code, or recipes, can automate the setup, configuration, deployment and management of virtual servers in a cloud. To better understand the value of Chef, consider the operational tasks a system admin would have to do. These tasks become daunting as the number of VMs increases.
- Create instances
- Configure instances with storage, services, firewall, software
- Monitor and delete instances
- Ensure all instances are in the correct state
Key concepts – Recipes, Cookbooks and Knife
Key concepts in Chef include recipes, cookbooks and knife.
- Recipe – a configuration element used to install/configure software and deploy applications. Recipes are executed in an ordered list called a “run list”.
- Cookbook – a unit of configuration that includes recipes. Examples of cookbooks are those that install and configure MySQL and Apache.
- Knife – a command-line-interface (CLI) for managing Chef. Use knife to manage recipes and cookbooks, provision resources and more. Knife is run from a Chef (Administrator) Workstation. Knife allows the configuration of a server, e.g. doing things that might otherwise require logging into a server via SSH and making changes manually. Knife also has a plugin for OpenStack.
Chef Operating Infrastructure
Chef requires two main operational components, a Chef Server and a Chef Workstation. Furthermore, there is a Chef-Client agent that is run on each node that is managed by Chef.
- Server – A central location that stores all the cookbooks, recipes and policies. It is a central machine that interacts with Chef-Clients on each node.
- Workstations – Workstations are where Chef configuration elements like recipes, cookbooks and policies are defined. The configuration elements are synchronized with a Chef Repo and uploaded to the Chef Server using knife.
- Nodes – Chef nodes are deployment targets that are configured by Chef.
In the following posts, we will setup a chef environment and create a cookbook. The examples shown in the blog post will demonstrate how to deploy and manage state on one cloud instance. The power of Chef is that it can easily scale and maintain consistent state across many cloud instances.
Post in this Blog Series
1. CHEF AND OPENSTACK PART 1 – KEY CONCEPTS
2. CHEF AND OPENSTACK PART 2A – INSTALL A (Version 11) CHEF SERVER, WORKSTATION AND CLIENT
3. CHEF AND OPENSTACK PART 3 – CREATE A COOKBOOK
4. CHEF AND OPENSTACK PART 2B – INSTALL A (Version 12) CHEF SERVER, WORKSTATION AND CLIENT