Created
March 9, 2010 03:36
-
-
Save Aslan/326124 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# | |
# Chef Client Config File | |
# | |
# Dynamically generated by Chef - local modifications will be replaced | |
# | |
require 'ohai' | |
require 'json' | |
o = Ohai::System.new | |
o.all_plugins | |
chef_config = JSON.parse(o[:ec2][:userdata]) | |
if chef_config.kind_of?(Array) | |
chef_config = chef_config[o[:ec2][:ami_launch_index]] | |
end | |
log_level :info | |
log_location STDOUT | |
chef_server_url "#{chef_config['chef_server']}:4000" | |
registration_url "#{chef_config['chef_server']}:4000" | |
template_url "#{chef_config['chef_server']}:4000" | |
remotefile_url "#{chef_config['chef_server']}:4000" | |
search_url "#{chef_config['chef_server']}:4000" | |
role_url "#{chef_config['chef_server']}:4000" | |
client_url "#{chef_config['chef_server']}:4000" | |
openid_url "#{chef_config["chef_server"]}:4001" | |
node_name o[:ec2][:instance_id] | |
validation_token chef_config["validation_token"] | |
if chef_config.has_key?("attributes") | |
File.open("/etc/chef/client-config.json", "w") do |f| | |
f.print(JSON.pretty_generate(chef_config["attributes"])) | |
end | |
json_attribs "/etc/chef/client-config.json" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment