Skip to content

Instantly share code, notes, and snippets.

@amccloud
Created January 11, 2013 21:24
Show Gist options
  • Save amccloud/4514076 to your computer and use it in GitHub Desktop.
Save amccloud/4514076 to your computer and use it in GitHub Desktop.
current_dir = File.dirname(__FILE__)
chef_repo_dir = File.dirname(current_dir)
home_dir = ENV["HOME"]
user = ENV["CHEF_USER"] || ENV["USER"]
server_url = ENV["CHEF_SERVER_URL"]
orgname = ENV["OPSCODE_ORGNAME"]
node_name user
client_key File.join(current_dir, "#{user}.pem")
cookbook_path [File.join(chef_repo_dir, "cookbooks")]
role_path [File.join(chef_repo_dir, "roles")]
data_bag_path [File.join(chef_repo_dir, "data_bags")]
log_level :info
log_location STDOUT
cache_type "BasicFile"
cache_options({
:path => File.join(current_dir, "checksums")
})
if orgname
chef_server_url "https://api.opscode.com/organizations/#{orgname}"
validation_client_name "#{orgname}-validator"
validation_key File.join(current_dir, "#{orgname}-validator.pem")
elsif server_url
chef_server_url server_url
validation_client_name "client-validator"
validation_key File.join(current_dir, "client-validator.pem")
else
raise "You must set the CHEF_SERVER_URL or the OPSCODE_ORGNAME environment variable."
end
knife[:rackspace_api_username] = ENV["RACKSPACE_USERNAME"]
knife[:rackspace_api_key] = ENV["RACKSPACE_API_KEY"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment