-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChef.txt
More file actions
56 lines (36 loc) · 1.27 KB
/
Copy pathChef.txt
File metadata and controls
56 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--Install Chefdk
curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable -v 0.18.30
--Check Chefdk version
chef --version
which chef
------------------------First Receipe---------------
Prog1: Create a Chef Reciepe which creates a file /hello.txt and add the content as Hello World
Create a file hello.rb and write the following code
file '/hello.txt' do
content 'Hello World'
end
--Execute above code
sudo chef-client --local-mode hello.rb
--Result :-Check /hello.txt file and that should exist with content Hello World
-----------------Resource Examples
package 'httpd' do
action :install
end
service 'httpd' do
action [ :enable, :start ]
end'
--------Chef Cookbook Examples
chef --help
chef generate --help
chef generate cookbook --help
Let's create a dir called cookbooks
---Create a cookbook called workstation
chef generate cookbook cookbooks/workstation
Create some reciepe in workstataion
chef-client -z --runlist "workstation::setup"
chef-client -z -r "recipe[workstation::setup]"
----How to include a recipe in another recipe
include_recipe 'workstation::setup'
chef-client -z -r "recipe[workstation]"
--------------Template Example
chef generate template cookbooks/workstation/ motd