When you are working behind a proxy you need to configure it for your virtualized environments. This is necessary, because Chef and Yum need to access artifacts from remote locations such as RPMs in case of Yum and Gems in case of Chef.
Proxy Setup with Vagrant and Chef
To set up the proxy for the virtualized Vagrant environment, you
need to configure the proxy URL and optionally its authentication credentials in the
Vagrantfile
or in one of the override locations provided by the
nugrant plugin.
To configure the proxy settings in the Vagrantfile
, you need to adapt the
proxy properties of the config.user.defaults
hash. To configure a proxy
externally, that is on a user-based level, you need to add a
~/.vagrantuser
file and add the following content:
proxy: url: "http://myproxy" username: "my username" password: "mypassword"
Proxy Setup with Chef only
When you trigger the provisioning with Chef, either using
chef-solo
or a chef-client
together with Chef
Server, you need to configure your proxy settings separately for
Chef and Yum.
For the Yum proxy settings you need to configure the
proxy
attributes of the yum cookbook. The documentation of the cookbook can be
found in the boxes/chef/chef-repo/cookbooks/yum/README.md
. You can
configure the proxy settings either in a recipe
, a role
or as
recommended in an environment
. In case you are using chef-solo
you
can use the node.json
file.
To configure the proxy for Chef itself, you need to configure the
proxy properties in the corresponding Chef configuration files. For
chef-solo
, this would be the solo.rb
file and for a
chef-client
the client.rb
. The properties you need to
configure are:
http_proxy
https_proxy
http_proxy_user
http_proxy_pass
For a complete reference, visit the official Chef Documentation.