-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathchef
More file actions
52 lines (43 loc) · 1.19 KB
/
chef
File metadata and controls
52 lines (43 loc) · 1.19 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
yum install wget -y
wget https://packages.chef.io/files/stable/chefdk/4.7.73/el/8/chefdk-4.7.73-1.el7.x86_64.rpm
rpm -ivh chefdk-4.7.73-1.el7.x86_64.rpm
rpm -qa | grep chef
yum install unzip -y
Download starter kit from Organization [Chef Mange site] and copy to /tem file in our instance using winSCP
unzip chef-starter.zip
cd chef-repo/
cp /tmp/Naresh_January.pem .
chmod 400 Naresh_January.pem
knife bootstrap 54.166.16.101 --connection-user ec2-user --sudo --ssh-identity-file Naresh_January.pem -N mynode1
knife client list
chef --version
mkdir mycookbook
cd mycookbook/
chef generate cookbook htmlcookbook
cd htmlcookbook/
chef generate recipe html
cd ~/mycookbook/
vi htmlcookbook/recipes/html.rb
#######################################################
package 'wget' do
action :install
end
package 'tree' do
action :install
end
package 'git' do
action :install
end
package 'httpd' do
action :install
end
file '/var/www/html/index.html' do
content 'hello friends'
action :create
end
service 'httpd' do
action [:enable, :start]
end
#######################################################
chef exec ruby -c htmlcookbook/recipes/html.rb
chef-client --local-mode htmlcookbook/recipes/html.rb