Skip to content

Instantly share code, notes, and snippets.

@CBeerta

CBeerta/knife.rb Secret

Created June 3, 2013 09:41
Show Gist options
  • Save CBeerta/4a0dcc8d442f4cf0e9a7 to your computer and use it in GitHub Desktop.
Save CBeerta/4a0dcc8d442f4cf0e9a7 to your computer and use it in GitHub Desktop.
Universal knife.rb
current_dir = File.dirname(__FILE__)
user_email = %x{git config --get user.email}.chomp
user_name = %x{git config --get user.name}.chomp
home_dir = ENV['HOME'] || ENV['HOMEDRIVE']
org = ENV['chef_org'] || 'my_org'
knife_override = "#{home_dir}/.chef/knife_override.rb"
chef_server_url "https://localhost"
log_level :info
log_location STDOUT
# USERNAME is UPPERCASE in Windows, but lowercase in the Chef server,
# so `downcase` it.
node_name ( ENV['USER'] || ENV['USERNAME'] ).downcase
client_key "#{home_dir}/.chef/#{node_name}.pem"
cache_type 'BasicFile'
cache_options( :path => "#{home_dir}/.chef/checksums" )
# We keep our cookbooks in separate repos under a ~/chef/cookbooks dir
cookbook_path ["#{current_dir}/../cookbooks", "#{current_dir}/../my-cookbooks"]
cookbook_copyright "#{user_name} <#{user_email}>"
cookbook_license "BSD"
cookbook_email "#{user_email}"
#http_proxy "http://webproxy.example.com:80"
#https_proxy "http://webproxy.example.com:80"
#no_proxy "localhost, 10.*, *.example.com, *.dev.example.com"
# Allow overriding values in this knife.rb
Chef::Config.from_file(knife_override) if File.exist?(knife_override)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment