# limitations under the License.
#
-chef_package = "chef_#{node[:chef][:client][:version]}_amd64.deb"
+chef_version = node[:chef][:client][:version]
+chef_package = "chef_#{chef_version}-1_amd64.deb"
directory "/var/cache/chef" do
owner "root"
end
remote_file "/var/cache/chef/#{chef_package}" do
- source "https://packages.chef.io/stable/ubuntu/12.04/#{chef_package}"
+ source "https://packages.chef.io/files/stable/chef/#{chef_version}/ubuntu/16.04/#{chef_package}"
owner "root"
group "root"
mode 0o644
dpkg_package "chef" do
source "/var/cache/chef/#{chef_package}"
- version node[:chef][:client][:version]
+ version "#{chef_version}-1"
end
directory "/etc/chef" do
exec_start "/usr/bin/chef-client -i 1800 -s 20"
restart "on-failure"
end
-
- service "chef-client" do
- provider Chef::Provider::Service::Systemd
- action [:enable, :start]
- supports :status => true, :restart => true, :reload => true
- subscribes :restart, "dpkg_package[chef]"
- subscribes :restart, "systemd_service[chef-client]"
- subscribes :restart, "template[/etc/chef/client.rb]"
- subscribes :restart, "template[/etc/chef/report.rb]"
- end
else
template "/etc/init/chef-client.conf" do
source "chef-client.conf.erb"
group "root"
mode 0o644
end
+end
- service "chef-client" do
- provider Chef::Provider::Service::Upstart
- action [:enable, :start]
- supports :status => true, :restart => true, :reload => true
- subscribes :restart, "dpkg_package[chef]"
- subscribes :restart, "template[/etc/init/chef-client.conf]"
- subscribes :restart, "template[/etc/chef/client.rb]"
- subscribes :restart, "template[/etc/chef/report.rb]"
+service "chef-client" do
+ action [:enable, :start]
+ if node[:lsb][:release].to_f >= 15.10
+ restart_command "systemctl kill --signal=TERM chef-client.service"
end
+ supports :status => true, :restart => true, :reload => true
+ subscribes :restart, "dpkg_package[chef]"
+ subscribes :restart, "template[/etc/init/chef-client.conf]"
+ subscribes :restart, "template[/etc/chef/client.rb]"
+ subscribes :restart, "template[/etc/chef/report.rb]"
end