Skip to content

Instantly share code, notes, and snippets.

@therobot
Created September 21, 2010 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save therobot/2fd4fce806aa0c33edb0 to your computer and use it in GitHub Desktop.
Save therobot/2fd4fce806aa0c33edb0 to your computer and use it in GitHub Desktop.
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Author:: Joshua Sierles <joshua@37signals.com>
# Author:: Jacobo Garcia <jacobo.garcia@gmail.com>
# Cookbook Name:: chef
# Recipe:: client
#
# Copyright 2008-2010, Opscode, Inc
# Copyright 2009, 37signals
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
service "chef-client" do
action :nothing
end
gem_package "mixlib-authentication"
gem_package "chef" do
version node[:chef][:client_version]
notifies :restart, resources(:service => "chef-client"), :immediately
end
root_group = value_for_platform(
"openbsd" => { "default" => "wheel" },
"freebsd" => { "default" => "wheel" },
"default" => "root"
)
ruby_block "reload_client_config" do
block do
Chef::Config.from_file("/etc/chef/client.rb")
end
action :nothing
end
template "/etc/chef/client.rb" do
source "client.rb.erb"
owner "root"
group root_group
mode "644"
notifies :create, resources(:ruby_block => "reload_client_config")
end
log "Add the chef::delete_validation recipe to the run list to remove the #{Chef::Config[:validation_key]}." do
only_if { File.exists?(Chef::Config[:validation_key]) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment