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.
22 chef_package = "chef_#{node[:chef][:client][:version]}_amd64.deb"
24 chef_platform = case node[:platform_version]
25 when "12.10" then "12.04"
26 when "14.04" then "13.04"
27 else node[:platform_version]
30 directory "/var/cache/chef" do
36 Dir.glob("/var/cache/chef/chef_*.deb").each do |deb|
37 if deb != "/var/cache/chef/#{chef_package}"
45 remote_file "/var/cache/chef/#{chef_package}" do
46 source "https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/#{chef_platform}/x86_64/#{chef_package}"
54 dpkg_package "chef" do
55 source "/var/cache/chef/#{chef_package}"
56 version node[:chef][:client][:version]
59 template "/etc/init/chef-client.conf" do
60 source "chef-client.conf.erb"
66 directory "/etc/chef" do
72 template "/etc/chef/client.rb" do
73 source "client.rb.erb"
79 file "/etc/chef/client.pem" do
85 template "/etc/chef/report.rb" do
86 source "report.rb.erb"
92 template "/etc/logrotate.d/chef" do
93 source "logrotate.erb"
99 directory "/etc/chef/ohai" do
105 directory "/var/log/chef" do
111 service "chef-client" do
112 provider Chef::Provider::Service::Upstart
113 action [ :enable, :start ]
114 supports :status => true, :restart => true, :reload => true
115 subscribes :restart, "dpkg_package[chef]"
116 subscribes :restart, "template[/etc/init/chef-client.conf]"
117 subscribes :restart, "template[/etc/chef/client.rb]"
118 subscribes :restart, "template[/etc/chef/report.rb]"