Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chef lec 18 - Coggle Diagram
Chef lec 18
Resources
Package
Service
User
Group
Template
Cookbook-file
File
Execute
Cron
Directory
Automatically creates
some files on installation
chefignore
like .gitignore
kitchen yml
for testing
cookbooks
Metadata rb
contains name,
version, author etc.
Readme.md
Usage of Cookbook
Recipe
Where you
write code
Spec
For unit testing
Test
For integration
testing
make
cookbooks
directory
generate cookbooks
in this directory
a
recipes
directory is
generated
automatically
Generate your
recipe here
First example
code
file '/myfile' do
content 'Welcome here'
action : create
end
To create a file
named as
myfile
in root directory
Always work in
/cookbooks
direectory
enter any
cookbook dir
only to create
recipe there
chef generate cookbook [name]
To create a cookbook
chef generate recipe [name]
To create Recipe
Always run this command in /cookbooks/cookbook/ dir
chef exec ruby -c [recipe]
To check syntax of the recipe
To run the recipe
chef-client -zr "recipe[[cookbook_name]::[recipe_name]]"
chef-client firstly retrieves the status
from Ohai
z = local machine,
r = run
if recipe_name not
given, default.rb runs
recipe code for apache
package installation
package "httpd" do
action :install
end
file '/var/www/html/index.html' do
content "welcome"
action :create
end
Service 'httpd' do
action [ :enable, :start]
end
Download Chef Workstation
from chef.sh