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]}.ubuntu.11.04_amd64.deb"
 
  24 directory "/var/cache/chef" do
 
  30 Dir.glob("/var/cache/chef/chef_*.ubuntu.11.04_amd64.deb").each do |deb|
 
  31   if deb != "/var/cache/chef/#{chef_package}"
 
  39 remote_file "/var/cache/chef/#{chef_package}" do
 
  40   action :create_if_missing
 
  41   source "https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/11.04/x86_64/#{chef_package}"
 
  48 dpkg_package "chef" do
 
  49   source "/var/cache/chef/#{chef_package}"
 
  50   version node[:chef][:client][:version]
 
  53 template "/etc/init/chef-client.conf" do
 
  54   source "chef-client.conf.erb"
 
  60 directory "/etc/chef" do
 
  66 template "/etc/chef/client.rb" do
 
  67   source "client.rb.erb"
 
  73 file "/etc/chef/client.pem" do
 
  79 template "/etc/chef/report.rb" do
 
  80   source "report.rb.erb"
 
  86 template "/etc/logrotate.d/chef" do
 
  87   source "logrotate.erb"
 
  93 directory "/etc/chef/ohai" do
 
  99 directory "/var/log/chef" do
 
 105 service "chef-client" do
 
 106   provider Chef::Provider::Service::Upstart
 
 107   action [ :enable, :start ]
 
 108   supports :status => true, :restart => true, :reload => true
 
 109   subscribes :restart, "dpkg_package[chef]"
 
 110   subscribes :restart, "template[/etc/init/chef-client.conf]"
 
 111   subscribes :restart, "template[/etc/chef/client.rb]"
 
 112   subscribes :restart, "template[/etc/chef/report.rb]"