NashTech Insights

Introduction to Chef

Mohd Muzakkir Saifi
Mohd Muzakkir Saifi
Table of Contents


Chef is an Administration and configuration tool. It was written in RUBY and ERlang. Chef was founded by Admin Jacobs in 2009. In the starting days, Chef was known as the marionette. but later on, renamed as CHEF. Basically, It enables automation and management of infra and application deployment. Chef allows administrators and developers to define the desired state of the system using recipes.

Feature of Chef:-

1. Automation:-

The chef automates the process of configuring and managing the infra and also It saves time and reduces the risk of manual errors or issues.

2. Platform Independent:-

This is platform independent tool. Basically, Chef can work for any OS or connect with any OS to configure.

3. Agent Bases Architecture:-

Chef utilizes an agent-based architecture, where it installs a lightweight agent known as chef-client on each node during the node configuration process. The chef-client then periodically communicates with the client-server to retrieve updates and apply the desired configurations defined in the chef-server.

4. Support for large organizations:-

Chef is built to manage large organizations and their infrastructure efficiently. It can handle the management of many nodes at once.

5. Chef – Supermarket:-

The Chef supermarket is a community-driven repository where users shared and collaborate on pre-build cookbooks and resources. Therefore, It acts as a central hub for the shared chef cookbook.

Component of the chef:-

1. Chef Workstation:-

Chef is an important component for any organization using chef tool for automation. A workstation is where individuals create or modify all the configuration code, and it can be a personal computer or virtual machine. Basically, The workstation is communicate with the chef server using ht Knife.

2. Chef – Server:-

It can be defined as a place where you can store the code or recipes. Basically, It is a middleman between workstations and nodes.

3. Node:-

You can define it as the location where changes or code are intended to be applied using a recipe. Node communicates with the chef server using chef-client to check the latest update in the desired state.

4. Knife:-

The knife is a command line tool for the chef. Basically, it establishes communication among the workstation, client-server, and node.

5. Recipe:-

A recipe is a core component of a chef’ configuration. It consists of instructions written in Ruby that describe the desired state of a system, although it is not exclusively reliant on Ruby.


I have mentioned the steps below. You can follow them and run. You will see that Chef is installed in our system:

Step 1:-


Step 2:-

       sudo dpkg –i  chef-workstation_0.4.2-1_amd64.deb​

Step 3:-

Which chef​​

Chef --version

Install the Nginx using Chef:-

Now, We will see how we can install the nginx in the node using Chef and update the string on the default page using Chef:-

Step1:- Create a working folder:-

mkdir cookbooks

Step2:- Create a cookbook in the cookbooks folder:-

chef generate cookbook <test-cookbook>

Step3:- Now create a recipe in the cookbook which we have created in the above step:-

cd test-cookbook

chef gengerate recipe <test-recipe>

Step4:- Add the below code in the recipe to install nginx and update the string for the default page:-

html_path = "/var/www/html/index.nginx-debian.html"

package "nginx" do
    action :install

file html_path do
  content "Welcome to Knolx session...."
    action :create

service "nginx" do
    action [:restart]

Step5:- Validate the recipe syntax:-

chef exec ruby -c test-cookbook/recipe/test-recipe

Step6:- Run the below command to execute the recipe on the node:-

chef-client -zr "recipe[test-cookbook::test-recipe]"

curl localhost


In this blog, we have learned about the chef and we have seen how we can create the cookbook and recipe to configure the nginx in the node [ in the above example I have used the local node and workstation]. If you like my blog then you can like this or want to read more blogs then follow this link. and also check out the chef’s official doc.

Mohd Muzakkir Saifi

Mohd Muzakkir Saifi

Leave a Comment

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

Suggested Article

%d bloggers like this: