KEMBAR78
Chef - Configuration Management Tool | PDF | Directory (Computing) | Operating System Technology
0% found this document useful (0 votes)
568 views5 pages

Chef - Configuration Management Tool

The document discusses configuration management tools like Chef and Ansible. It provides instructions on installing Chef workstation, creating a sample "testcookbook" with a recipe to create a file, and running the recipe locally using chef-client. Key points are: - Chef and Ansible are configuration management tools that automate infrastructure configuration tasks. - The document shows how to install Chef workstation, generate a cookbook and recipe to create a file, and run the recipe locally using chef-client. - Recipes define tasks or scenarios to be executed, and are contained within cookbooks in Chef.

Uploaded by

Bhaskar kovvuru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
568 views5 pages

Chef - Configuration Management Tool

The document discusses configuration management tools like Chef and Ansible. It provides instructions on installing Chef workstation, creating a sample "testcookbook" with a recipe to create a file, and running the recipe locally using chef-client. Key points are: - Chef and Ansible are configuration management tools that automate infrastructure configuration tasks. - The document shows how to install Chef workstation, generate a cookbook and recipe to create a file, and run the recipe locally using chef-client. - Recipes define tasks or scenarios to be executed, and are contained within cookbooks in Chef.

Uploaded by

Bhaskar kovvuru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Configuration Management Tool

Configuration Management
 Configuration management is a process similar to what administrators do
manually, here the same tasks are performed by initiating automation.
 We are automating the configuration tasks by using configuration
management tools like Ansible, Chef, Puppet, Saltstack.
 Here we are converting code into infrastructure.
 Infrastructure as a code -> IAC
 Since everything here is code we can test, repeat and we can apply version
control.

Features of Chef
 Agent needs to be installed on each Chef Node
 Relies on knife protocol for communication
 Uses ruby language
 Pull mechanism

Chef VS Ansible
Chef Architecture

Installation of Chef Workstation


 Command:- wget https://packages.chef.io/files/stable/chef-
workstation/21.2.278/el/8/chef-workstation-21.2.278-1.el7.x86_64.rpm
 Command:- yum -y install chef-workstation-21.2.278-1.el7.x86_64.rpm
 Command:- chef --version (to verify chef package version installed)

Create your first Cookbook


 Cookbook is a group of recipes and some other files and folders
 Each cookbook defines a scenario
 Create a new directory to keep all our cookbooks
 Command:- mkdir cookbooks
 Go inside the new directory and create a cookbook (Whatever commands are
going to be execute from here onwards, has to be executed under this new
cookbooks directory)
 Command:- chef generate cookbook testcookbook
 To view the list of all file and folders in tree format of the new cookbook use
 Command:- tree testcookbook
Contents of a Cookbook
 The following files and folders will be present under the Cookbook directory.
 Chefignore – acts as .gitignore file. The files you want to ignore you can here.
 Metadata.rb – this file consists of name, author, version…etc of a cookbook
 Readme.rb – info about the usage of a cookbook
 Recipe – where you write the ruby code to execute certain tasks
 Spec – used for unit testing
 Test – used for integration testing

Create your first Recipe


 Be inside the Cookbooks folder created in earlier slide.
Command:- chef generate recipe testrecipe
vi cookbookname/recipes/ testrecipe.rb
file '/newfile1' do
content "Hello Vince!! testing our first recipe"
action :create
end

Run a Cookbook
 To verify the code which you have written run the below command
 Command:- chef exec ruby –c testcookbook/recipes/testrecipe.rb
 You will get an output “SYNTAX OK” if the code is correct.
 Apply that recipe locally to your machine as we didn’t setup Chef Node
machines yet.
 Command:- chef-client -zr 'recipe[testcookbook::testrecipe]‘
 Verify the file myfile is created under / directory or not by giving the below
command.
 Command:- ls /
Create your second Recipe

You might also like