Assignment5.1(Chef)
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Chef:
Chef is a tool used for Configuration Management. Chef is an automation tool that provides a way to define infrastructure as code. Infrastructure as code simply means that managing infrastructure by writing code rather than using manual processes. It can also be termed as programmable infrastructure. Chef uses a pure-Ruby, domain-specific language for writing system configuration.
Advantages of Chef:
- Accelerating Software Delivery
- Increasing Service Resiliency
- Improving Risk Management
- Accelerating Cloud Adoption
- Managing Both Data Center and Cloud Environments
- Delivering All Your Infrastructure
- Reduction of work time
- Application to multiple servers at once
- Reduction of operation cost
- Redecoration of construction
Installation of chef workstation:
- wget https://packages.chef.io/files/stable/chef-workstation/22.5.923/el/7/chef-workstation-22.5.923-1.el7.x86_64.rpm
- ls
- rpm -ivh chef-workstation-22.5.923-1.el7.x86_64.rpm
- which chef
- ls /usr/bin/chef*
- chef version
Example program for recipe:
$ chef-apply filename.rb
In file.rb type:
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 root
end
httpd
create a index.html
copy index.htmkl
start
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