From fab154da39fc3f68e66b8d36f44457533e53dac1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 13:29:38 +0200 Subject: Allow specifying custom mirrors for every supported archive. --- README | 20 ++++++++++++-------- manifests/init.pp | 17 +++++++++++++++++ templates/sources.list.erb | 32 ++++++++++++++++---------------- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/README b/README index 1a0fd3c..133ad22 100644 --- a/README +++ b/README @@ -44,12 +44,11 @@ value can be set manually too, e.g. to enable forced upgrades $custom_sources_list -------------------- -By default this module will use a basic apt/sources.list with a -generic debian mirror. If you need to set more specific sources, -e.g. for country proximity, proxies, etc. you can set this variable to -the location of your sources.list template. For example, setting the -following variable before including this class will pull in the -templates/apt/sources.list file: +By default this module will use a basic apt/sources.list. +If you need to set more specific sources, e.g. for proxies, etc. you +can set this variable to the location of your sources.list template. +For example, setting the following variable before including this +class will pull in the templates/apt/sources.list file: $custom_sources_list ='template("apt/sources.list")' $custom_preferences @@ -101,6 +100,13 @@ low values. By default this is false for backward compatibility with older versions of this module. +$apt_debian_url, $apt_security_url, $apt_backports_url, $apt_volatile_url +------------------------------------------------------------------------- + +These variables allow to override the default APT mirrors respectively +used for the standard Debian archives, the Debian security archive, +the Debian official backports and the Debian Volatile archive. + Classes ======= @@ -156,8 +162,6 @@ TODO Enable debian-archive-keyring handling for sarge, lenny and sid. -Enable selection of country-specific mirrors. - Currently this module updates the caches on every run. Running dselect update is a expensive operation and should be done only on schedule by using apticron. Sometimes -- especially when initially starting management or deploying new diff --git a/manifests/init.pp b/manifests/init.pp index 095fe79..63f489f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -26,6 +26,23 @@ class apt { default => $apt_use_next_release, } + $debian_url = $apt_debian_url ? { + '' => 'http://ftp.debian.org/debian/', + default => "${apt_debian_url}", + } + $security_url = $apt_security_url ? { + '' => 'http://security.debian.org/', + default => "${apt_security_url}", + } + $backports_url = $apt_backports_url ? { + '' => 'http://backports.debian.org/debian-backports/', + default => "${apt_backports_url}", + } + $volatile_url = $apt_volatile_url ? { + '' => 'http://volatile.debian.org/debian-volatile/', + default => "${apt_volatile_url}", + } + package { apt: ensure => installed, require => undef, diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 687e790..c5d69e7 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -3,18 +3,18 @@ ### Debian current: <%= codename %> # basic -deb http://ftp.debian.org/debian/ <%= codename %> <%= repos %> +deb <%= debian_url > <%= codename %> <%= repos %> <% if include_src then %> -deb-src http://ftp.debian.org/debian/ <%= codename %> <%= repos %> +deb-src <%= debian_url > <%= codename %> <%= repos %> <% end %> # security <% if (release == "unstable" || release == "experimental") %> # There is no security support for <%= release %> <% else %> -deb http://security.debian.org/ <%= codename %>/updates <%= repos %> +deb <%= security_url > <%= codename %>/updates <%= repos %> <% if include_src then %> -deb-src http://security.debian.org/ <%= codename %>/updates <%= repos %> +deb-src <%= security_url > <%= codename %>/updates <%= repos %> <% end %> <% end %> @@ -22,9 +22,9 @@ deb-src http://security.debian.org/ <%= codename %>/updates <%= repos %> <% if (release == "testing" || release == "unstable" || release == "experimental") %> # There is no backports archive for <%= release %> <% else %> -deb http://backports.debian.org/debian-backports/ <%= codename %>-backports <%= repos %> +deb <%= backports_url > <%= codename %>-backports <%= repos %> <% if include_src then %> -deb-src http://backports.debian.org/debian-backports/ <%= codename %>-backports <%= repos %> +deb-src <%= backports_url > <%= codename %>-backports <%= repos %> <% end %> <% end %> @@ -33,9 +33,9 @@ deb-src http://backports.debian.org/debian-backports/ <%= codename %>-backports <% if (release == "testing" || release == "unstable" || release == "experimental") %> # There is no volatile archive for <%= release %> <% else %> -deb http://volatile.debian.org/debian-volatile/ <%= codename %>/volatile <%= repos %> +deb <%= volatile_url > <%= codename %>/volatile <%= repos %> <% if include_src then %> -deb-src http://volatile.debian.org/debian-volatile/ <%= codename %>/volatile <%= repos %> +deb-src <%= volatile_url > <%= codename %>/volatile <%= repos %> <% end %> <% end %> <% end %> @@ -44,18 +44,18 @@ deb-src http://volatile.debian.org/debian-volatile/ <%= codename %>/volatile <%= ### Debian next: <%= next_codename %> # basic -deb http://ftp.debian.org/debian/ <%= next_codename %> <%= repos %> +deb <%= debian_url > <%= next_codename %> <%= repos %> <% if include_src then %> -deb-src http://ftp.debian.org/debian/ <%= next_codename %> <%= repos %> +deb-src <%= debian_url > <%= next_codename %> <%= repos %> <% end %> # security <% if (next_release == "unstable" || next_release == "experimental") %> # There is no security support for <%= next_release %> <% else %> -deb http://security.debian.org/ <%= next_codename %>/updates <%= repos %> +deb <%= security_url > <%= next_codename %>/updates <%= repos %> <% if include_src then %> -deb-src http://security.debian.org/ <%= next_codename %>/updates <%= repos %> +deb-src <%= security_url > <%= next_codename %>/updates <%= repos %> <% end %> <% end %> @@ -63,9 +63,9 @@ deb-src http://security.debian.org/ <%= next_codename %>/updates <%= repos %> <% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") %> # There is no backports archive for <%= next_release %> <% else %> -deb http://backports.debian.org/debian-backports/ <%= next_codename %>-backports <%= repos %> +deb <%= backports_url > <%= next_codename %>-backports <%= repos %> <% if include_src then %> -deb-src http://backports.debian.org/debian-backports/ <%= next_codename %>-backports <%= repos %> +deb-src <%= backports_url > <%= next_codename %>-backports <%= repos %> <% end %> <% end %> @@ -74,9 +74,9 @@ deb-src http://backports.debian.org/debian-backports/ <%= next_codename %>-backp <% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") %> # There is no volatile archive for <%= next_release %> <% else %> -deb http://volatile.debian.org/debian-volatile/ <%= next_codename %>/volatile <%= repos %> +deb <%= volatile_url > <%= next_codename %>/volatile <%= repos %> <% if include_src then %> -deb-src http://volatile.debian.org/debian-volatile/ <%= next_codename %>/volatile <%= repos %> +deb-src <%= volatile_url > <%= next_codename %>/volatile <%= repos %> <% end %> <% end %> <% end %> -- cgit v1.2.3