Configuring puppet.conf To Support A Proxy Server

Needed to configure a new Puppet Enterprise server to use a proxy server so that it could search and install modules from Puppet Forge since initial attempts to download were failing with:

[root@test01 /]# puppet module search motd Notice: Searching https://forge.puppetlabs.com Error: Could not connect to https://forge.puppetlabs.com There was a network communications problem The error we caught said ‘getaddrinfo: Name or service not known’ Check your network connection and try again

I found the setting http_proxy_host and also some incorrect examples which suggested something like the following should be added to puppet.conf

[main] certname = test01.local vardir = /var/opt/lib/pe-puppet logdir = /var/log/pe-puppet rundir = /var/run/pe-puppet modulepath = /etc/puppetlabs/puppet/modules:/opt/puppet/share/puppet/modules server = test01.local user = pe-puppet group = pe-puppet archive_files = true archive_file_server = test01.local http_proxy_host = proxy.server01.local:8080

turns out you can’t supply the port number on this line, an additional parameter http_proxy_port is needed to make it work

[main] certname = test01.local vardir = /var/opt/lib/pe-puppet logdir = /var/log/pe-puppet rundir = /var/run/pe-puppet modulepath = /etc/puppetlabs/puppet/modules:/opt/puppet/share/puppet/modules server = test01.local user = pe-puppet group = pe-puppet archive_files = true archive_file_server = test01.local http_proxy_host = proxy.server01.local http_proxy_port = 8080

Now things are happier :-)

Update: The above only fixed _ puppet module search motd_ for me, not  puppet module install puppetlab-motd

Looks like you might also need to set the following environment variables too:

export http_proxy=http://proxy.server01.local:8080

export https_proxy=http://proxy.server01.local:8080

http://projects.puppetlabs.com/issues/15453