Automation Using Chef & Jenkins

Flentas Tech 22nd April 2022 - 5 mins read

Technology is the driving force for organizations in today's world. Technology reduces human effort by simplifying the working of any given machine. Automation is one such technology that reduces human intervention in the processes. Automation is a technology that performs a function through programs and commands combined with automatic feedback control to ensure proper execution of the instructions. This term was first used in 1946 in the automobile industry to describe the increased use of automotive devices and controls in mechanized production lines.

Why Alexa?

One of the foremost reason of using Alexa is "Responsiveness". To use Alexa, you need not use any button for activation. You just say "Alexa" or "Echo" or "Computer" or "Amazon", which are the triggers for Alexa, followed by the activity you want to perform and your work would be done. Only you have to be careful about the alexa set-up and using the correct commands. Alexa Echo speaker is currently in its 2nd generation and has every possible feature available from smart home systems to digital-assistant abilities.
Automation enables you to scale your business and is significantly cost-saving as it allows your IT team to focus on other strategic work.

Automation using Chef and Jenkins

Jenkins is a continuous integration (CI) server which allows developers to update a repo multiple times a day with various developers, solving the problem of having different copies of the same source code. You can build software with each commit to the code, quickly identifying bugs using a continuous integration server. Jenkins has an extensive range of plugins, and thus the need to build software manually is reduced. Custom build rules and dependencies can be set in Jenkins as it is a highly configurable tool.
A Chef is an automation tool that provides a way to define infrastructure as a source (IaaS), which means automating infrastructure rather than using a manual process. Chef is used for continuous deployment (CD), which means you have production code ready with each change to the codebase. Changes to the code can be delivered to the customer immediately using Chef. Thus, Chef is an ideal partner to use with Jenkins. You can create bug-free application code ready for deployment using Jenkins and Chef Integration. Chef creates cookbooks that are used to deploy your application code to the server, thus making your application go live. .

Chef and Jenkins architecture

Chef architecture

Chef works on a three-tier client-server model wherein the working units like cookbooks are developed under the workstation; using CLI, we can deploy the cookbooks to the Chef server and all the nodes present in architecture.

Chef Workstation: This is where all the configurations are developed. The Chef workstation is installed on the local machine.

Chef server: This works as a centralized working unit of Chef Setup, where all the configuration files are uploaded post-development. There are different Chef Servers; some are hosted Chef Servers, whereas some are built-in premises.

Chef nodes: are the actual machines that the Chef server will manage. The Chef client is the critical component of all the nodes, which helps set up the interaction between the Chef server and Chef Node. All nodes can have different kinds of setups as per requirement.

Jenkins architecture

The single Jenkins server is not enough to meet specific requirements, and hence Jenkins distributed architecture is used to meet these needs.

Jenkins distributed architecture: Jenkins uses master-slave architecture to manage distributed builds. Master and slave communicate through TCP/IP protocol.

Jenkins master: The central Jenkins server is the master. The job of the master is to schedule build jobs, dispatch builds to the slaves for actual execution, monitor the slaves, and record and create slave results.

Jenkins slave: Slave is a java executable that runs on a local machine. Characteristics of Jenkins slaves are: It hears requests from Jenkins master instance and can run on any operating system. The primary function of a slave is to execute build jobs dispatched by the master.

Jenkins build pipeline: It is used to know which task Jenkins is currently executing. In the build pipeline, builds are broken into sections such as units and acceptance tests, packaging, reporting, and deployment phases.

To Summarise

Jenkins will publish the new cookbooks to Chef Workstation. Chef Workstation would run CLI commands to update the cookbook to Chef-server.

Nodes can be configured to run a bash command Chef-client at regular intervals, or we can achieve the same by running knife commands inside the shell of the Chef server.

To add a node to Chef-server: we will run a command: "Knife bootstrap nodeipaddress -U username -P password –node-name anything."

Several plugins available in Jenkins can interact with Node to get deployment status to monitor the deployments.


  • Allows creating environments for nodes, allowing you to deploy artifacts to particular environments.
  • The "Knife" tool lessens installation headaches
  • Easy to build, deploy or launch anything async.
  • Rich set of plugins with excellent documentation.
  • Easily extendable and seamless integration.

The blog explains Automation using Chef and Jenkins, its architecture, and its working.

Top Blog Posts


Talk to our experts:

Talk to our experts to discuss your requirements