]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Add a proxy-client class
authorGabriel Filion <lelutin@gmail.com>
Mon, 18 Oct 2010 00:42:09 +0000 (20:42 -0400)
committerGabriel Filion <lelutin@gmail.com>
Mon, 18 Oct 2010 00:42:09 +0000 (20:42 -0400)
The module currently doesn't have a handy way of making a server get its
packages via a proxy. Add a "proxy-client" class that makes this easy.

$apt_proxy declares the proxy server's fqdn
$apt_proxy_port declares the port used for connection

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
manifests/proxy-client.pp [new file with mode: 0644]

diff --git a/manifests/proxy-client.pp b/manifests/proxy-client.pp
new file mode 100644 (file)
index 0000000..ea0a29c
--- /dev/null
@@ -0,0 +1,18 @@
+class apt::proxy-client {
+
+  $real_apt_proxy = $apt_proxy ? {
+    "" => "localhost",
+    default => $apt_proxy
+  }
+
+  $real_apt_proxy_port = $apt_proxy_port ? {
+    "" => "3142",
+    default => $apt_proxy_port
+  }
+
+  file { "/etc/apt/apt.conf.d/20proxy":
+    ensure => present,
+    content => "Acquire::http { Proxy \"http://$real_apt_proxy:$real_apt_proxy_port\"; };\n",
+    owner => root, group => 0, mode => 0644;
+  }
+}