5 # Copyright 2010, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
24 chef_package = "chef_#{node[:chef][:client][:version]}_amd64.deb"
26 directory "/var/cache/chef" do
32 Dir.glob("/var/cache/chef/chef_*.deb").each do |deb|
33 next if deb == "/var/cache/chef/#{chef_package}"
41 remote_file "/var/cache/chef/#{chef_package}" do
42 source "https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/10.04/x86_64/#{chef_package}"
50 dpkg_package "chef" do
51 source "/var/cache/chef/#{chef_package}"
52 version node[:chef][:client][:version]
55 directory "/etc/chef" do
61 template "/etc/chef/client.rb" do
62 source "client.rb.erb"
68 file "/etc/chef/client.pem" do
74 template "/etc/chef/report.rb" do
75 source "report.rb.erb"
81 template "/etc/logrotate.d/chef" do
82 source "logrotate.erb"
88 directory "/etc/chef/trusted_certs" do
94 template "/etc/chef/trusted_certs/verisign.pem" do
95 source "verisign.pem.erb"
101 directory node[:ohai][:plugin_dir] do
107 directory "/var/log/chef" do
113 if node[:lsb][:release].to_f >= 15.10
114 execute "systemctl-daemon-reload" do
116 command "systemctl daemon-reload"
119 template "/etc/systemd/system/chef-client.service" do
120 source "chef-client.service.erb"
124 notifies :run, "execute[systemctl-daemon-reload]"
127 service "chef-client" do
128 provider Chef::Provider::Service::Systemd
129 action [:enable, :start]
130 supports :status => true, :restart => true, :reload => true
131 subscribes :restart, "dpkg_package[chef]"
132 subscribes :restart, "template[/etc/systemd/system/chef-client.service]"
133 subscribes :restart, "template[/etc/chef/client.rb]"
134 subscribes :restart, "template[/etc/chef/report.rb]"
137 template "/etc/init/chef-client.conf" do
138 source "chef-client.conf.erb"
144 service "chef-client" do
145 provider Chef::Provider::Service::Upstart
146 action [:enable, :start]
147 supports :status => true, :restart => true, :reload => true
148 subscribes :restart, "dpkg_package[chef]"
149 subscribes :restart, "template[/etc/init/chef-client.conf]"
150 subscribes :restart, "template[/etc/chef/client.rb]"
151 subscribes :restart, "template[/etc/chef/report.rb]"