Chef is an open source tool and framework that provides developers and systems administrators a foundation of APIs and libraries, which are used to perform tasks such as configuring and managing IT infrastructures. The concept behind using framework technology is to reduce development time by minimising the overhead of implementing and managing the low-level details that support the development effort. This enables organisations to concentrate on delivery and meeting the customers requirements.
Chef is a framework for infrastructure development, which provides a supporting structure and package for framing ones infrastructure as code. It provides extensive libraries for building up an infrastructure that can be deployed within a software project. It provides a Ruby-based DSL modelling infrastructure, which enables developers and systems administrators to build and design scalable environments without considering the operating systems. It produces consistent, shareable and reusable components.
Chef provides various tools built on the framework for designing the infrastructure. These tools are based on high level programming languages such as Python and Ruby. Some of the tools are:
1) Ohai, a system profiling tool, which is an extendable plug-in to furnish the data that is used to build up the database of each system that is managed by Chef.
2) Shef, an interactive debugging console for testing and exploring Chefs behaviour in various conditions. It provides command line access to framework libraries.
3) Chef-Solo, a configuration management tool, which allows access to subsets of Chefs features.
4) Chef Client, an agent that runs on the system managed by Chef to communicate with the Chef server.
5) Knife, a multi-purpose command line tool, which provides system automation, integration, and deployment.
A Few features of Chef
|
How Chef works
Chef converts infrastructure into code. Whatever operations can be done with the code, can be done with the infrastructure as well. Yes, it is possible to keep infrastructure versions, test them and create infrastructure repeatedly and efficiently.
A resource is a definition of an action that can be taken such as the installation of a package, Web server or application server; or managing a configuration file. Chef uses reusable components known as recipes to automate infrastructure. A recipe is a collection of resources that includes packages, templates and so on. A cookbook is a set of recipes such as the installation of the Web server, the database server, and configuration file changes to connect the Web and database servers in different deployment environments. A workstation is the place where the Knife is configured to upload cookbooks to the Chef server. Chefs command-line tool, Knife, is used to interact with the Chef server and upload cookbooks. Attributes provide specific details of a node, such as the IP address and other configuration details.
The Chef server is the central registry or brain of the entire process and can act as a hub. It consists of information about the infrastructure and cookbooks. The latter are used to instruct Chef on how each node must be configured. The Chef server can be either hosted on-premise, on the cloud or be offered by some service provider as well. It is used to deploy cookbooks to the nodes. There is an option of signing up for Opscodes Hosted Chef. Each node is registered with the Chef server, which distributes cookbooks to the nodes based on different configuration settings.
The Chef client is installed on the nodes; it contacts the Chef server, fetches cookbooks and executes them on nodes. The Chef client does the actual configuration. It polls the Chef server at regular intervals for the most recent recipes, and checks node compliance with the policy defined by the most recent recipes. If the node is out of sync, the Chef client runs the policy on the node to bring it up-to-date. A node can be a physical server, a virtual server or a virtual machine in a private cloud or public cloud environment. Many plug-ins are available for Knife that provide support for cloud-based environments. Amazon EC2, Amazon Virtual Private Cloud, VMware, Google Compute Engine, OpenStack, Rackspace and Microsoft Azure are supported cloud platforms or cloud-based environments. A Chef client is an agent that runs locally on every node hosted in different environments, and follows the steps shown in Figure 2.
Chef, VMware, AWS and continuous delivery
A Chef and VMware-based private cloud
Chef is the configuration management tool and an automation platform for installing, configuring and managing VMware infrastructure. It can be used to automate the entire stack including provisioning and de-provisioning VMs, templates and networks.
vCloud Air is a public cloud platform built on the foundation of vSphere. It is compatible with the on-premises data centre. It allows organisations to extend workloads into the cloud or to migrate existing onsite virtual machines to the public cloud. Chef can be used to automate migrations to vCloud Air. Chef has the capability of provisioning new vCloud Air VMs and bootstrap, as well as list the vCloud Air VMs, vApps, templates or images, networks, NAT rules, firewall rules and public IP addresses.
VMware vCenter Server is a centralised management tool to manage virtualisation environments based on VMware vSphere. It can be used to manage multiple ESXi servers and virtual machines with a single console application. It provides enterprise level features such as high availability and fault tolerance with VMotion, Storage VMotion and Distributed Resource Scheduler. The knife-esx plug-in gives you full control of ESX-hosted virtual machines. Chefs knife-vsphere plug-in is used to provision and manage VMs with VMware vCenter. The knife-vsphere plug-in can be used to list data stores, resource pools and clusters; to list, clone, and delete VMs; perform specific actions by executing commands on deployed virtual machines; to customise or reconfigure vCPUs, VRAM, and IP addresses to clone a VM; and to clone and bootstrap Linux VMs and Windows VMs.
VMware ESXi is an enterprise-level operating system-independent hypervisor offered by VMware. It is a Type 1 hypervisor for guest virtual machines. It runs on a physical host without an underlying operating system support and hence it gives better performance than Type 2 hypervisors. Chef can be used to provision/de-provision or manage virtual machines hosted by ESXi. The knife-esx plug-in is used to integrate Chef with ESXi.
Advantages of Chef in a VMware environment
There are many advantages of using Chef in a VMware environment as listed below:
- Write once, deploy many times
- No manual configurations
- No inconsistencies in environment
- Standardised run time environment; application deployment, middleware and databases
Chef and the Amazon public cloud
Chef and Amazon public cloud integration makes infrastructure fast and agile. The knife-ec2 plug-in is used to integrate AWS and Chef. It allows cloud consumers to launch and configure EC2 instances, to create base Amazon Machine Images, to register EC2 instances with Elastic Load Balancers, to manage EBS volumes and raid devices. It is very easy to spin off a Windows 2012 server, configure IIS and deploy a .NET app in AWS with the use of Chef, which provides speed and efficiency with standard environments. In AWS, it is very easy to maximise the uptime of the Chef server by taking advantage of Chefs integration with Amazons elastic block storage and elastic IPs. Different AWS regions can also be used to gain high availability.
Comparisons between Chef and Puppet
Heres a comparison of two configuration management toolsChef and Puppet, which will enable you to take an informed decision based on the needs and expertise your organisation has in using Chef or Puppet.
References
[1] http://en.wikipedia.org/wiki/Chef_%28software%29
[2] http://en.wikipedia.org/wiki/Puppet_%28software%29
[3] http://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software
[4] http://www.slideshare.net/scriptrock/puppet-vs-chef
[5] http://docs.getchef.com/
[6] https://www.getchef.com/solutions/aws/
[7] https://www.getchef.com/solutions/vmware/
[8] https://www.getchef.com/solutions/continuous-delivery/