diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-01-26 11:08:33 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-01-26 11:08:33 -0200 |
commit | 311ce8d3ddafd00543bdbde6b59e3453f88d159f (patch) | |
tree | 296e22a9794d469a2038015eb4d09df62d425ca4 | |
parent | 3106af6835c72e587431f0817601545e9c41393f (diff) | |
download | puppet-apt-311ce8d3ddafd00543bdbde6b59e3453f88d159f.tar.gz puppet-apt-311ce8d3ddafd00543bdbde6b59e3453f88d159f.tar.bz2 |
Adding proxy support
-rw-r--r-- | manifests/init.pp | 24 | ||||
-rw-r--r-- | templates/proxy.erb | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 7d52135..dcd4b20 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,6 +21,16 @@ class apt { default => $apt_update_method, } + $apt_http_proxy = $apt_http_proxy ? { + '' => false, + default => $apt_http_proxy, + } + + $apt_ftp_proxy = $apt_ftp_proxy ? { + '' => false, + default => $apt_ftp_proxy, + } + package { apt: ensure => installed } # a few templates need lsbdistcodename @@ -229,6 +239,20 @@ class apt { } } } + + if $apt_http_proxy or $apt_ftp_proxy { + file { "/etc/apt/apt.conf.d/proxy": + owner => root, + group => root, + mode => 0644, + content => template("apt/proxy.erb"), + require => File[apt_config], + } + } else { + file { "/etc/apt/apt.conf.d/proxy": + ensure => absent, + } + } } class dselect { diff --git a/templates/proxy.erb b/templates/proxy.erb new file mode 100644 index 0000000..01c9861 --- /dev/null +++ b/templates/proxy.erb @@ -0,0 +1,4 @@ +Acquire { +<% if apt_http_proxy != false %> HTTP::Proxy "<%= apt_http_proxy %>";<% end %> +<% if apt_ftp_proxy != false %> FTP::Proxy "<%= apt_ftp_proxy %>";<% end %> +}; |