L16 – Execute commands on the node
Execute linux commands on a chef client.
There is a default file created as part of apache install, lets delete it !
/etc/httpd/conf.d/welcome.conf
$ vi ~/chef-repo/cookbooks/apache/recipes/default.rb
AND ADD
execute “rm /etc/httpd/conf.d/welcome.conf” do
only_if do
File.exist?(“/etc/httpd/conf.d/welcome.conf”)
end
notifies :restart, “service[httpd]”
end
execute “rm /etc/httpd/conf.d/README” do
only_if do
File.exist?(“/etc/httpd/conf.d/README”)
end
notifies :restart, “service[httpd]”
end
$ knife cookbook upload apache
etc
Discussion ¬