What is Automation and Configuration Management with CHEF – Part 1

Let’s take a simple scenario, you have 10 redhat servers where you have to create a ‘tecmint’ user in all the servers. The direct approach is, you need to login into each server and create the user with the useradd command. When the servers are 100s or 1000s, login into all servers one by one is practically not possible.

Here, the first thing that comes to our mind in such cases is to write a script and let the script perform the execution on servers, it is a proven approach. Scripting has its own disadvantages, though it is widely used in organizations, it is tough to maintain if the script owner leaves the Organization.

The script will not work in a heterogeneous environment. The script is an Imperative method to accomplish the task, where you need to write lengthy code for a simple task etc., this situation demands us to look for Automation and Configuration Management tools such as a Chef.

In this series of articles on Chef, we are going to see about the installation and configuration procedures of the Chef Automation tool through parts 1-3 and covers the following topics.

Part 1: What is Automation and Configuration Management with CHEF
Part 2: How to Install CHEF Workstation in RHEL/CentOS 8/7
Part 3: How to Install CHEF Client-Server model in RHEL/CentOS 8/7

This tutorial provides a starting point about how Chef works, automation, configuration management, architecture, and components of Chef.

1. Configuration Management

Configuration Management is the key focus point of DevOps practice. In the Software development cycle, all the servers should be software-configured and maintained well in such a way that they should not make any break in the development cycle. Bad configuration Management can make system outages, leaks, and data breaches. Using Configuration Management tools is about facilitating accuracy, efficiency, and speed in the DevOps-driven environment.

There are two models of configuration Management tools – PUSH-based & PULL-based. In the PUSH-based, the Master server pushes the configuration code to the servers wherein PULL-based individual servers contact the Master for getting configuration code. PUPPET and CHEF are widely used PULL-based models, ANSIBLE is a popular PUSH-based model. In this article, we will see about CHEF.

2. What is a Chef?

A chef is an open-source automation program that enables system administrators to automate the deployment, configurations, management, and ongoing tasks across a number of servers and other devices of an organization in a simple easy way.

  • It is established in 2008 as OPSCODE later it is renamed to CHEF (Chef Automation tool).
  • It is a Ruby-based automation tool used to manage the configuration, automate and orchestrate the entire infrastructure of an organization.
  • It is an Opensource project and comes with two deployment models: Server Client & Standalone.
  • Chef supports various Operating systems like Ubuntu, Redhat/CentOS, Fedora, macOS, Windows, AIX, etc.
  • The chef is declarative and is much simpler than native scripting languages.
  • It provides Continuous deployment to enable a company to keep updated with the Market requirement.
  • The Primary responsibility of the Chef is maintaining the defined state of Configuration.
  • It has its own declarative language to manage 10s and 1000s of nodes with ease.
  • The chef is adaptable to the cloud, easily integrates with Infrastructure on Cloud.
  • The chef is easy to learn and a strong community-supported DevOps-friendly tool.

3. Chef Architecture

Chef architecture is divided into 3 major sections.

  • Chef WorkStation: Local development platform for Chef users to create, test, and apply configurations. It can be your local desktop, laptop with Chef DK (Development Kit) installed. It can be used as a development/testing environment before promoting into Production.
  • Chef Server: It is a server having chef-server software installed and configured on it. It is responsible for managing the Chef’s code and accessing the configuration code from Chef Workstation. The chef server should be a Linux machine, it won’t support any other Operating system.
  • Chef Clients: There are the servers that contact the Chef server for configuration details such as chef code and other dependent files in binaries. It pulls the code from the Chef server and deploys them locally.
Chef Architecture
Chef Architecture

4. Chef Components

Following are the key Chef components.

  • Resources are the basic module of Recipe used to manage the Infrastructure.
  • The attribute is the settings in the form of key-value pair.
  • Recipes are the collection of attributes that can be made in the Workstation. It is a set of commands that can be applied to the Chef Clients as Chef Code.
  • Collection of Recipes is called a Cookbook.
  • A knife is a command-line tool in Chef Workstation that interacts with the Chef Server.

5. Chef Deployment Model

There are two deployment models for Chef.

  • Server Client – It is used for Production Deployment.
  • Chef Zero – It is used for Development, Testing, and POCs.

6. How Chef work? Infrastructure as Code

Infrastructure as Code is IT Infrastructure Management where it allows us to automatically perform various installation/deployment and Configuration Management. Here, all the configurations, installations are written as code.

  • The Chef client/node will do registration and authentication with the Chef server.
  • Chef client/node will do periodically look into the Chef Server. The authentication process is done every time when the chef-client wants to access the data stored in the chef-server.
  • Ohai is a tool that will be run by a Chef client to determine the system state, it will detect the attributes (OS, memory, disk, CPU, kernel, etc.,) of the node and provide those attributes to the chef-client. Ohai is part of Chef Client installation.
  • If there are any changes on the Cookbook or Configuration settings, it will be sent to the Chef-Client and will be updated/installed.
  • Cookbooks and settings will be updated in the Chef server using Chef Workstation through the command-line tool Knife. The Workstation pushes all the policies to the Chef server using Knife.
  • As each client/node will be having a periodic check with the Chef server, configurations will be applied individually according to the server role. For example: In the Chef Nodes, some nodes will be Database servers, some nodes will be gateway servers, etc.
Conclusion

In this article, we have seen basic concepts of Configuration Management and Chef automation tool. We will see the step-by-step process of Chef installation in the upcoming articles.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

1 thought on “What is Automation and Configuration Management with CHEF – Part 1”

Leave a Reply to Manoj Gupta Cancel reply

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

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