Created
January 27, 2011 18:50
-
-
Save Aslan/798978 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 | |
# Automatically grabs configuration from ohai ec2 metadata. | |
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"] | |
registration_url chef_config["chef_server"] | |
openid_url chef_config["chef_server"] | |
template_url chef_config["chef_server"] | |
remotefile_url chef_config["chef_server"] | |
search_url chef_config["chef_server"] | |
role_url chef_config["chef_server"] | |
client_url chef_config["chef_server"] | |
node_name o[:ec2][:instance_id] | |
unless File.exists?("/etc/chef/client.pem") | |
File.open("/etc/chef/validation.pem", "w") do |f| | |
f.print(chef_config["validation_key"]) | |
end | |
end | |
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 | |
validation_key "/etc/chef/validation.pem" | |
validation_client_name chef_config["validation_client_name"] | |
Mixlib::Log::Formatter.show_time = true |
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
2011-01-27_18:36:18.02134 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.02716 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.07545 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.08577 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.09506 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.10325 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.14139 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.16244 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.19042 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.19930 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.21085 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.22019 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.22761 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.23930 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:18.35622 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18791 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18791 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18790 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18790 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18789 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18789 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18789 [Thu, 27 Jan 2011 10:36:18 -0800] WARN: ***************************************** | |
2011-01-27_18:36:37.18789 [Thu, 27 Jan 2011 10:36:18 -0800] WARN: Can not find config file: /etc/chef/client.rb, using defaults. | |
2011-01-27_18:36:37.18789 [Thu, 27 Jan 2011 10:36:18 -0800] WARN: undefined method `[]' for nil:NilClass | |
2011-01-27_18:36:37.18789 [Thu, 27 Jan 2011 10:36:18 -0800] WARN: ***************************************** | |
2011-01-27_18:36:37.18788 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18788 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18787 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18786 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18786 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18786 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18785 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18785 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18783 sh: Syntax error: "(" unexpected | |
2011-01-27_18:36:37.18783 [Thu, 27 Jan 2011 10:36:37 -0800] INFO: Client key /etc/chef/client.pem is not present - registering | |
2011-01-27_18:36:37.18783 [Thu, 27 Jan 2011 10:36:37 -0800] FATAL: Failed to read the private key /etc/chef/validation.pem: #<Errno::ENOENT: No such file or directory - /etc/chef/validation.pem>, /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:59:in `read'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:59:in `load_signing_key'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:33:in `initialize'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest.rb:48:in `new'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest.rb:48:in `initialize'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/client.rb:240:in `new'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/client.rb:240:in `register'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/client.rb:144:in `run'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application/client.rb:222:in `run_application'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application/client.rb:212:in `loop'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application/client.rb:212:in `run_application'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application.rb:62:in `run'/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/chef-client:26/opt/ruby-enterprise/bin/chef-client:19:in `load'/opt/ruby-enterprise/bin/chef-client:19 | |
2011-01-27_18:36:37.18783 [Thu, 27 Jan 2011 10:36:37 -0800] ERROR: Chef::Exceptions::PrivateKeyMissing:I cannot read /etc/chef/validation.pem, which you told me to use to sign requests! | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:62:in `load_signing_key' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:33:in `initialize' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest.rb:48:in `new' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest.rb:48:in `initialize' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/client.rb:240:in `new' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/client.rb:240:in `register' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/client.rb:144:in `run' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application/client.rb:222:in `run_application' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application/client.rb:212:in `loop' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application/client.rb:212:in `run_application' | |
2011-01-27_18:36:37.18783 /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/application.rb:62:in `run' |
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
{ | |
"attributes": { | |
"run_list": [ | |
"role[frontend_app_qa]" | |
] | |
}, | |
"validation_key": "-----BEGIN RSA PRIVATE KEY-----key body -----END RSA PRIVATE KEY-----\n", | |
"validation_client_name": "chef-validator", | |
"chef_server": "http://qa-admin-server-1441155499.us-east-1.elb.amazonaws.com:4000" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment