Day5 – Assignment 1 – by Gorsa Lakshmi Niharika

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

What is Chef?

Chef is a tool which accelerates the application delivery and DevOps collaboration. Chef helps us to solve the day to day problem by treating infrastructure as a code. Rather being tested manually changing everything, the machine setup will be described in detail in Chef recipe. It is an open source systems management and cloud infrastructure automation platform. Chef transforms infrastructure into code to automate server deployment and management.

10 Advantages of Chef:

-> Accelerating Software deployment

-> Accelerating its software delivery

-> Increase Service Flexibility

-> Cloud adoption

-> Integration

-> Capability to run as Infrastructure as code

-> Managing cloud as well as Data center

-> Resiliency workflow

-> Test driven based infrastructure

-> A streamlined IT operations

How to install Chef Workstation?

Visit the chef workstation downloads official page and select appropriate package for your version. Click on the download button. Follow the steps as displayed.

We copied the downloading file path and entered over centos7

$ wget "<link>"
$ rpm -ivh chef-workstation-22.5.923-1.el7.x86_64.rpm
$ which chef

Example program of Recipe:

Create vi file.rb
Put the code: 
file '/opt/first.txt'
file '/opt/first.txt' do
	action :delete
end
file '/opt/content.txt' do
	content "This is my first program of chef"
	mode 755
	owner "niharika"
end

Create another file vi web.rb
package 'name' do
  package_name               "httpd"
end

file 'index.html' do
  content                    "<h1> Welcome to DevOpsSchool Chef Class</h1>"
end

bash 'extract_module' do
  code <<-EOH
                cp index.html /var/www/html/
  EOH
end

service 'httpd' do
  service_name         "httpd"
  action               :start
end

Now, run chef-apply web.rb
-> chef generate cookbook webserver
-> vi webserver/recipes/default.rb
-> mkdir cookbooks
-> mv webserver/ cookbooks/
-> chef-client --local-mode --runlist 'recipe[webserver]'

It’s done

Subscribe
Notify of
guest

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

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x