Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
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