3

I'm trying to run a puppet manifest which depends on the target machine having proxy settings to access the Internet.

I haven't been able to pass http_proxy_host as Puppet suggests (I believe its a bug?).

I've tried to update .bashrc on my Debian box (through the puppet manifest) though I'm not sure how to get the settings to take the first time round.

Instead I believe a solution would be to set/pass the env var http_proxy however I'm not sure how/where to do this with Vagrant.

https://groups.google.com/d/msg/puppet-users/2aivOoYHwZ0/rjRkJx1zdjQJ suggests using a wrapper like so...

#!/bin/bash
export http_proxy=my.proxy
puppet apply "$@"

I'm not 100% sure where to do this, or if this is the best solution.

Surely I'm not the only one trying to use Vagrant/Puppet & Proxies?

3 Answers 3

1

try setting your proxy like this:

#!/bin/bash
export http_proxy=http://my.proxy:3128
puppet apply "$@"
1

I use a shell provisioner in my Vagrantfile before the Puppet provisioner:

config.vm.provision :shell, :inline => "echo 'export http_proxy=http://proxy.company.com:3128' >> /etc/profile.d/proxy.sh"
1

I'm a bit biased, but I would recommend using vagrant-proxyconf plugin. To configure all Vagrant machines, you can use $HOME/.vagrant.d/Vagrantfile or environment variables. This way you don't need to modify all project specific Vagrantfiles.

Example:

Vagrant.configure("2") do |config|
  config.proxy.http  = "http://my.proxy:3128"
  config.proxy.https = "http://my.proxy:3128"
  # other configuration...
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.