Skip to content

Instantly share code, notes, and snippets.

@CBeerta CBeerta/knife.rb Secret
Created Jun 3, 2013

What would you like to do?
Universal knife.rb
current_dir = File.dirname(__FILE__)
user_email = %x{git config --get}.chomp
user_name = %x{git config --get}.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 ""
#https_proxy ""
#no_proxy "localhost, 10.*, *, *"
# 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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.