-
-
Save holgr/1007180 to your computer and use it in GitHub Desktop.
Chef cookbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/chef/attributes/chef.rb | |
set_unless[:chef][:log_location] = "STDOUT" | |
set_unless[:chef][:log_level] = "info" | |
set_unless[:chef][:url_type] = "http" | |
set_unless[:chef][:server_fqdn] = "your-chef-server" | |
set_unless[:chef][:server_port] = "4000" | |
set_unless[:chef][:validation_client_name] = "chef-validator" | |
set_unless[:chef][:cache_path] = "/var/cache/chef" | |
set_unless[:chef][:run_path] = "/var/run/chef" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/chef/recipes/client.rb | |
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" | |
mode 0644 | |
backup false | |
notifies :create, resources(:ruby_block => "reload_client_config") | |
end | |
file "/etc/chef/validation.pem" do | |
action :delete | |
backup false | |
only_if { File.size?("/etc/chef/client.pem") } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/chef/templates/default/client.rb.erb | |
# | |
# Chef Client Config File | |
# | |
# Dynamically generated by Chef - local modifications will be replaced | |
# | |
log_level :info | |
log_location <%= @node[:chef][:log_location] %> | |
ssl_verify_mode :verify_none | |
<% case @node[:chef][:url_type] -%> | |
<% when "http" -%> | |
chef_server_url "http://<%= @node[:chef][:server_fqdn] %>:<%= @node[:chef][:server_port] %>" | |
<% when "https" -%> | |
chef_server_url "https://<%= @node[:chef][:server_fqdn] %>" | |
<% end -%> | |
validation_client_name "<%= @node[:chef][:validation_client_name] %>" | |
validation_key "/etc/chef/validation.pem" | |
client_key "/etc/chef/client.pem" | |
file_cache_path "<%= @node[:chef][:cache_path] %>" | |
pid_file "<%= @node[:chef][:run_path] %>/client.pid" | |
Mixlib::Log::Formatter.show_time = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment