Skip to content

Instantly share code, notes, and snippets.

@jasmeralia
Created June 14, 2016 17:24
Show Gist options
  • Save jasmeralia/ffe7a6dc79bbff1e6b715b05fc4681b7 to your computer and use it in GitHub Desktop.
Save jasmeralia/ffe7a6dc79bbff1e6b715b05fc4681b7 to your computer and use it in GitHub Desktop.
include_recipe 'moxie-inventory'
dc_and_mode = node['moxie']['dc_and_mode']
case dc_and_mode
when 'pdx_pci'
proxies = Chef::EncryptedDataBagItem.load('pci_proxy', dc_and_mode)
http_proxy = proxies['http_proxy']
https_proxy = proxies['https_proxy']
Chef::Log.info("Setting http_proxy to #{http_proxy}")
Chef::Log.info("Setting https_proxy to #{https_proxy}")
# Set the config that will get written to disk
node.override['chef-client']['config']['http_proxy'] = http_proxy
node.override['chef-client']['config']['https_proxy'] = https_proxy
# Set environmental variables that will be used inside the chef run for chef_gem, remote_file, etc.
Chef::Config[:https_proxy] = ENV['HTTPS_PROXY'] = ENV['https_proxy'] = https_proxy
Chef::Config[:http_proxy] = ENV['HTTP_PROXY'] = ENV['http_proxy'] = http_proxy
#
# Have chef update its own configuration
#
include_recipe 'chef-client::config'
end
include_recipe 'chef-sugar::default'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment