Skip to content

Instantly share code, notes, and snippets.

@PaulusTM
Forked from garystafford/knife.rb
Last active September 16, 2015 09:58
Show Gist options
  • Save PaulusTM/5b91ff299d25c24085a0 to your computer and use it in GitHub Desktop.
Save PaulusTM/5b91ff299d25c24085a0 to your computer and use it in GitHub Desktop.
Gists for blogpost, 'Configure Chef on Windows for a Proxy Server': http://wp.me/p1RD28-11w. Settings for knife.rb file when using a proxy server from a Windows host. Set environment variables manually or use the Windows' command 'setx VARIABLE value'. You must close the current windows prompt and open a new one to see the SETX changes (env | gr…
# See http://docs.opscode.com/config_rb_knife.html
# for more information on knife configuration options
# Knife expects USERNAME, USERDNSDOMAIN, PASSWORD, PROXY_SERVER,
# and PROXY_PORT environment variables to be set at runtime.
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "chef_user_here"
client_key "#{ENV['HOME']}/.chef/chef_client_here.pem"
validation_client_name "organization_here-validator"
validation_key "#{ENV['HOME']}/.chef/organization_here-validator.pem"
chef_server_url "https://api.opscode.com/organizations/organization_here"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path [ "#{ENV['HOME']}/path/to/your/cookbooks",
"#{ENV['HOME']}/other/path/to/your/cookbooks"
]
# comment below block when not behind proxy
#=begin
# proxy server settings
no_proxy ENV['NO_PROXY']
http_proxy ENV['HTTP_PROXY']
http_proxy_user ENV['USERNAME']
http_proxy_pass ENV['PASSWORD']
https_proxy ENV['HTTPS_PROXY']
https_proxy_user ENV['USERNAME']
https_proxy_pass ENV['PASSWORD']
# knife upload requires rest client proxy. Ignores above settings.
# install rest-client gem: gem install rest-client
# http://rubydoc.info/github/rest-client/rest-client
require 'rest-client'
RestClient.proxy = ENV['HTTP_PROXY']
#=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment