aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README128
-rw-r--r--files/50unattended-upgrades19
-rw-r--r--files/preferences8
-rw-r--r--lib/puppet/parser/functions/debian_nextcodename.rb11
-rw-r--r--lib/puppet/parser/functions/debian_nextrelease.rb11
-rw-r--r--lib/puppet/parser/functions/debian_release.rb13
-rw-r--r--manifests/cron/base.pp3
-rw-r--r--manifests/cron/dist-upgrade.pp23
-rw-r--r--manifests/cron/download.pp21
-rw-r--r--manifests/dselect.pp3
-rw-r--r--manifests/init.pp102
-rw-r--r--manifests/preferences.pp10
-rw-r--r--manifests/preseeded_package.pp4
-rw-r--r--templates/Debian/preferences_lenny.erb24
-rw-r--r--templates/Debian/preferences_sid.erb9
-rw-r--r--templates/Debian/preferences_squeeze.erb24
-rw-r--r--templates/Debian/sources.list.deb-src.erb12
-rw-r--r--templates/Debian/sources.list.erb84
-rw-r--r--templates/Debian/sources.list.volatile.erb8
-rw-r--r--templates/Ubuntu/sources.list.backports.erb5
-rw-r--r--templates/Ubuntu/sources.list.deb-src.erb13
-rw-r--r--templates/Ubuntu/sources.list.erb21
22 files changed, 430 insertions, 126 deletions
diff --git a/README b/README
index 355ee72..2cbf246 100644
--- a/README
+++ b/README
@@ -9,13 +9,18 @@ package download current.
backports.debian.org is added.
-/etc/apt/sources.list and /etc/apt/preferences are managed. Testing and
-unstable are pinned to very low values by default to prevent accidental
-upgrades.
+/etc/apt/sources.list and /etc/apt/preferences are managed. More
+recent Debian releases are pinned to very low values by default to
+prevent accidental upgrades.
-This module needs lsb-release installed.
+Ubuntu support is lagging behind but not absent either.
-By default, this module sets the cofiguration option DSelect::Clean to 'auto'.
+This module needs:
+
+- lsb-release installed
+- the common module: git://labs.riseup.net/shared-common
+
+By default, this module sets the configuration option DSelect::Clean to 'auto'.
It is the recommended value on normal hosts. On virtual servers, the
recommended value is 'pre-auto', since virtual servers are usually more
space-bound and have better recovery mechanisms via the host:
@@ -45,25 +50,12 @@ Contains the codename ("etch", "lenny", ...) of the client's
release. While these values come from lsb-release by default, this
value can be set manually too, e.g. to enable forced upgrades.
-$main_apt_source
-----------------
-
-If the default sources.list template (see next variable) suits your needs but
-you simply need to change the URL to the apt source used, set this variable to
-the URL that is desired. The default value for this variable is
-"http://ftp.debian.org/debian/" for Debian and
-"http://de.archive.ubuntu.com/ubuntu/" for Ubuntu.
-
-Here's an example for setting a local source near Montreal, Quebec, Canada:
-
- $apt_main_source = "ftp://debian.mirror.iweb.ca/debian/"
-
$custom_sources_list
--------------------
-By default this module will use a basic apt/sources.list template with a
-generic debian mirror. If you need to set more specific sources, e.g. changing
-the sections included in the source or removing backports, etc. you can set
+By default this module will use a basic apt/sources.list template with
+a generic Debian mirror. If you need to set more specific sources,
+e.g. changing the sections included in the source, etc. you can set
this variable to the content that you desire to use instead.
For example, setting the following variable before including this class will
@@ -71,20 +63,20 @@ pull in the templates/site-apt/sources.list file:
$custom_sources_list = template("site-apt/sources.list")
-$custom_preferences
--------------------
+$custom_preferences
+--------------------
-Since Debian stable's version of apt doesn't support the use of the
-preferences.d directory for putting fragments of 'preferences', this module
-will manage a default basic apt/preferences file with unstable and testing
-pinned to very low values so that any package installation will not
-accidentally pull in packages from those suites unless you explicitly specify
-the version number. This file will be complemented with all of the
-preferences_snippet calls (see below).
+Since Debian stable's version of APT doesn't support the use of the
+preferences.d directory for putting fragments of 'preferences', this
+module will manage a default generic apt/preferences file with more
+recent releases pinned to very low values so that any package
+installation will not accidentally pull in packages from those suites
+unless you explicitly specify the version number. This file will be
+complemented with all of the preferences_snippet calls (see below).
-If you are not using the 'stable' branch or if the default preferences file
-doesn't suit your needs, you can create a file named 'preferences' in a
-site-apt module's files directory. You can also create a host-specific file:
+If the default preferences template doesn't suit your needs, you can
+create a file named 'preferences' in a site-apt module's files
+directory. You can also create a host-specific file:
site-apt
- files/
@@ -92,7 +84,7 @@ site-apt module's files directory. You can also create a host-specific file:
- preferences
preferences
-You can set this variable to false before including this class will force the
+Setting this variable to false before including this class will force the
apt/preferences file to be absent:
$custom_preferences = false
@@ -119,12 +111,70 @@ Here's an example of setting the proxy to 'http://proxy.domain' at port 666:
$apt_proxy_port = 666
include apt::proxy_client
+$apt_volatile_enabled
+-----------------
+
+If this variable is set to true the Debian Volatile sources are added.
+By default this is false for backward compatibility with older
+versions of this module.
+
+$apt_include_src
+----------------
+
+If this variable is set to true a deb-src source is added for every
+added binary archive source.
+By default this is false for backward compatibility with older
+versions of this module.
+
+$apt_use_next_release
+---------------------
+
+If this variable is set to true the sources for the next Debian
+release are added. The default pinning configuration pins it to very
+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.
+
+$apt_ubuntu_url
+---------------
+
+These variables allows to override the default APT mirror used for all
+standard Ubuntu archives (including updates, security, backports).
+
+$apt_repos
+----------
+
+If this variable is set the default repositories list ("main contrib non-free")
+is overriden.
+
Classes
=======
-Most of the functionality is provided by the 'apt' class, but some
-functionality is not inclulded by default. To use it, you must inlucde one of
-the following classes:
+apt
+---
+
+The apt class sets up most of the documented functionality. To use
+functionality that is not enabled by default, you must inlucde one of
+the following classes.
+
+apt::cron::download
+-------------------
+
+This class sets up cron-apt so that it downloads upgradable packages,
+does not actually do any upgrade and email when the output changes.
+
+apt::cron::dist-upgrade
+-----------------------
+
+This class sets up cron-apt so that it dist-upgrades the system and
+email when upgrades are performed.
apt::dselect
------------
@@ -247,7 +297,9 @@ TODO
====
Currently this module updates the caches on every run. Running apt-get update is
-an expensive operation and should be done only on schedule by using apticron.
+an expensive operation and should be done only on schedule by using
+apticron or cron-apt.
+
Sometimes -- especially when initially starting management or deploying new
packages -- a immediate update is really needed to be able to install the right
packages without errors. Thus a method should be devised to be able to specify
diff --git a/files/50unattended-upgrades b/files/50unattended-upgrades
index 384b373..d9535bc 100644
--- a/files/50unattended-upgrades
+++ b/files/50unattended-upgrades
@@ -17,11 +17,11 @@ APT::UnattendedUpgrades::LogDir "/var/log/";
APT::UnattendedUpgrades::LogFile "unattended_upgrades.log";
Unattended-Upgrade::Package-Blacklist {
- // we don't want the kernel to be updated so nagios still can give a warnig if there is
+ // we don't want the kernel to be updated so nagios still can give a warning if there is
// a manual update (and reboot) left
-
+
"linux-image-*";
-
+
// unfortunately there seems to be a bug in unattended-upgrades <= 0.25.1 that wildcards aren't recognized:
//2009-12-11 13:41:43,267 INFO Initial blacklisted packages: linux-image-*
//2009-12-11 13:41:43,267 INFO Starting unattended upgrades script
@@ -29,7 +29,7 @@ Unattended-Upgrade::Package-Blacklist {
//2009-12-11 13:41:45,233 INFO Packages that are upgraded: linux-image-2.6.26-2-amd64
//2009-12-11 13:41:45,233 INFO Writing dpkg log to '/var/log/unattended-upgrades-dpkg_2009-12-11_13:41:45.233713.log'
//2009-12-11 13:42:11,988 INFO All upgrades installed
-
+
// lenny
"linux-image-2.6.26-1-686";
"linux-image-2.6.26-1-amd64";
@@ -37,12 +37,21 @@ Unattended-Upgrade::Package-Blacklist {
"linux-image-2.6.26-1-xen-amd64";
"linux-image-2.6.26-1-vserver-686";
"linux-image-2.6.26-1-vserver-amd64";
-
+
"linux-image-2.6.26-2-686";
"linux-image-2.6.26-2-amd64";
"linux-image-2.6.26-2-xen-686";
"linux-image-2.6.26-2-xen-amd64";
+ "linux-image-2.6.26-2-vserver-686";
"linux-image-2.6.26-2-vserver-amd64";
+ // squeeze
+ "linux-image-2.6.32-5-686";
+ "linux-image-2.6.32-5-amd64";
+ "linux-image-2.6.32-5-xen-686";
+ "linux-image-2.6.32-5-xen-amd64";
+ "linux-image-2.6.32-5-vserver-686";
+ "linux-image-2.6.32-5-vserver-amd64";
+
};
diff --git a/files/preferences b/files/preferences
deleted file mode 100644
index e893b7e..0000000
--- a/files/preferences
+++ /dev/null
@@ -1,8 +0,0 @@
-Package: *
-Pin: release a=unstable
-Pin-Priority: 1
-
-Package: *
-Pin: release a=testing
-Pin-Priority: 2
-
diff --git a/lib/puppet/parser/functions/debian_nextcodename.rb b/lib/puppet/parser/functions/debian_nextcodename.rb
new file mode 100644
index 0000000..6bc4b6b
--- /dev/null
+++ b/lib/puppet/parser/functions/debian_nextcodename.rb
@@ -0,0 +1,11 @@
+module Puppet::Parser::Functions
+ newfunction(:debian_nextcodename, :type => :rvalue) do |args|
+ case args[0]
+ when "etch" then "lenny"
+ when "lenny" then "squeeze"
+ when "squeeze" then "sid"
+ when "sid" then "experimental"
+ else "sid"
+ end
+ end
+end
diff --git a/lib/puppet/parser/functions/debian_nextrelease.rb b/lib/puppet/parser/functions/debian_nextrelease.rb
new file mode 100644
index 0000000..76c3e0d
--- /dev/null
+++ b/lib/puppet/parser/functions/debian_nextrelease.rb
@@ -0,0 +1,11 @@
+module Puppet::Parser::Functions
+ newfunction(:debian_nextrelease, :type => :rvalue) do |args|
+ case args[0]
+ when 'oldstable' then 'stable'
+ when 'stable' then 'testing'
+ when 'testing' then 'unstable'
+ when 'unstable' then 'experimental'
+ else 'unstable'
+ end
+ end
+end
diff --git a/lib/puppet/parser/functions/debian_release.rb b/lib/puppet/parser/functions/debian_release.rb
new file mode 100644
index 0000000..64feb66
--- /dev/null
+++ b/lib/puppet/parser/functions/debian_release.rb
@@ -0,0 +1,13 @@
+module Puppet::Parser::Functions
+ newfunction(:debian_release, :type => :rvalue) do |args|
+ case args[0]
+ when 'etch' then 'oldstable'
+ when 'lenny' then 'stable'
+ when 'squeeze' then 'testing'
+ when 'wheezy' then 'testing'
+ when 'sid' then 'unstable'
+ when 'experimental' then 'experimental'
+ else 'testing'
+ end
+ end
+end
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp
new file mode 100644
index 0000000..2cfbefb
--- /dev/null
+++ b/manifests/cron/base.pp
@@ -0,0 +1,3 @@
+class apt::cron::base {
+ package { cron-apt: ensure => installed }
+}
diff --git a/manifests/cron/dist-upgrade.pp b/manifests/cron/dist-upgrade.pp
new file mode 100644
index 0000000..3d7cf16
--- /dev/null
+++ b/manifests/cron/dist-upgrade.pp
@@ -0,0 +1,23 @@
+class apt::cron::dist-upgrade inherits apt::cron::base {
+
+ $action = "autoclean -y
+dist-upgrade -y -o APT::Get::Show-Upgraded=true
+"
+
+ file { "/etc/cron-apt/action.d/3-download":
+ ensure => absent,
+ }
+
+ package { "apt-listbugs": ensure => absent }
+
+ config_file { "/etc/cron-apt/action.d/4-dist-upgrade":
+ content => $action,
+ require => Package[cron-apt]
+ }
+
+ config_file { "/etc/cron-apt/config.d/MAILON":
+ content => "MAILON=upgrade\n",
+ require => Package[cron-apt]
+ }
+
+}
diff --git a/manifests/cron/download.pp b/manifests/cron/download.pp
new file mode 100644
index 0000000..a27967d
--- /dev/null
+++ b/manifests/cron/download.pp
@@ -0,0 +1,21 @@
+class apt::cron::download inherits apt::cron::base {
+
+ $action = "autoclean -y
+dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
+"
+
+ file { "/etc/cron-apt/action.d/4-dist-upgrade":
+ ensure => absent,
+ }
+
+ config_file { "/etc/cron-apt/action.d/3-download":
+ content => $action,
+ require => Package[cron-apt]
+ }
+
+ config_file { "/etc/cron-apt/config.d/MAILON":
+ content => "MAILON=changes\n",
+ require => Package[cron-apt]
+ }
+
+}
diff --git a/manifests/dselect.pp b/manifests/dselect.pp
index fb138da..52c66cb 100644
--- a/manifests/dselect.pp
+++ b/manifests/dselect.pp
@@ -1,9 +1,8 @@
class apt::dselect {
# suppress annoying help texts of dselect
- line { dselect_expert:
+ append_if_no_such_line { dselect_expert:
file => "/etc/dpkg/dselect.cfg",
line => "expert",
- ensure => present,
}
package { dselect: ensure => installed }
diff --git a/manifests/init.pp b/manifests/init.pp
index 140d2a6..c48cb6e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -5,20 +5,77 @@
class apt {
+ $use_volatile = $apt_volatile_enabled ? {
+ '' => false,
+ default => $apt_volatile_enabled,
+ }
+
+ $include_src = $apt_include_src ? {
+ '' => false,
+ default => $apt_include_src,
+ }
+
+ $use_next_release = $apt_use_next_release ? {
+ '' => false,
+ 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}",
+ }
+ $ubuntu_url = $apt_ubuntu_url ? {
+ '' => 'http://archive.ubuntu.com/ubuntu',
+ default => "${apt_ubuntu_url}",
+ }
+ case $operatingsystem {
+ 'debian': {
+ $repos = $apt_repos ? {
+ '' => 'main contrib non-free',
+ default => "${apt_repos}",
+ }
+ }
+ 'ubuntu': {
+ $repos = $apt_repos ? {
+ '' => 'main restricted universe multiverse',
+ default => "${apt_repos}",
+ }
+ }
+ }
+
package { apt:
ensure => installed,
require => undef,
}
- $real_main_apt_source = $main_apt_source ? {
- '' => $operatingsystem ? {
- "Ubuntu" => "http://de.archive.ubuntu.com/ubuntu/",
- default => "http://ftp.debian.org/debian/",
- },
- default => $main_apt_source,
+ include lsb
+
+ # init $release, $next_release, $codename, $next_codename
+ case $lsbdistcodename {
+ '': {
+ $codename = $lsbdistcodename
+ $release = $lsbdistrelease
+ }
+ default: {
+ $codename = $lsbdistcodename
+ $release = debian_release($codename)
+ }
}
+ $next_codename = debian_nextcodename($codename)
+ $next_release = debian_nextrelease($release)
- include lsb
config_file {
# include main, security and backports
# additional sources should be included via the apt::sources_list define
@@ -30,7 +87,6 @@ class apt {
require => Package['lsb'];
}
- # 01autoremove already present by default
apt_conf { "02show_upgraded":
source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded",
"puppet:///modules/site-apt/02show_upgraded",
@@ -54,6 +110,17 @@ class apt {
}
}
+ # backward compatibility: upgrade from previous versions of this module.
+ file {
+ ["/etc/apt/apt.conf.d/from_puppet",
+ "/etc/apt/apt.conf.d/99from_puppet"
+ ]:
+ ensure => 'absent',
+ require => [ Apt_conf_snippet['02show_upgraded'],
+ Apt_conf_snippet['03clean'],
+ ],
+ }
+
# watch .d directories and ensure they are present
file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; }
file { "/etc/apt/sources.list.d":
@@ -67,16 +134,17 @@ class apt {
'refresh_apt':
command => '/usr/bin/apt-get update && sleep 1',
refreshonly => true,
- subscribe => File['/etc/apt/sources.list',
- '/etc/apt/apt.conf.d',
- '/etc/apt/preferences'];
- 'update_apt':
- command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
- require => File['/etc/apt/sources.list',
+ subscribe => [ File['/etc/apt/apt.conf.d'],
+ Config_file['/etc/apt/sources.list'] ];
+ 'update_apt':
+ command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
+ refreshonly => true,
+ require => [ File['/etc/apt/apt.conf.d',
'/etc/apt/preferences'],
- loglevel => info,
- # Another Semaphor for all packages to reference
- alias => "apt_updated";
+ Config_file['/etc/apt/sources.list'] ],
+ loglevel => info,
+ # Another Semaphor for all packages to reference
+ alias => "apt_updated";
}
## This package should really always be current
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
index 5be3bd0..4acfdaf 100644
--- a/manifests/preferences.pp
+++ b/manifests/preferences.pp
@@ -4,9 +4,13 @@ class apt::preferences {
$apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences"
module_dir{'apt/preferences': }
file{"${apt_preferences_dir}_header":
- source => ["puppet:///modules/site-apt/${fqdn}/preferences",
- "puppet:///modules/site-apt/preferences",
- "puppet:///modules/apt/preferences"]
+ content => $custom_preferences ? {
+ '' => $operatingsystem ? {
+ 'debian' => template("apt/${operatingsystem}/preferences_${codename}.erb"),
+ 'ubuntu' => '',
+ },
+ default => $custom_preferences
+ },
}
concatenated_file{'/etc/apt/preferences':
diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp
index 276c90f..76c432e 100644
--- a/manifests/preseeded_package.pp
+++ b/manifests/preseeded_package.pp
@@ -1,8 +1,8 @@
define apt::preseeded_package ($content = "", $ensure = "installed") {
$seedfile = "/var/cache/local/preseeding/$name.seeds"
$real_content = $content ? {
- "" => template ( "$debian_version/$name.seeds" ),
- Default => $content
+ "" => template ( "$name.seeds", "$debian_version/$name.seeds" ),
+ default => $content
}
file{ $seedfile:
diff --git a/templates/Debian/preferences_lenny.erb b/templates/Debian/preferences_lenny.erb
new file mode 100644
index 0000000..3de7959
--- /dev/null
+++ b/templates/Debian/preferences_lenny.erb
@@ -0,0 +1,24 @@
+Explanation: Debian <%= codename %>
+Package: *
+Pin: release o=Debian,n=<%= codename %>
+Pin-Priority: 990
+
+Explanation: Debian backports
+Package: *
+Pin: origin backports.debian.org
+Pin-Priority: 200
+
+Explanation: Debian <%= next_codename %>
+Package: *
+Pin: release o=Debian,n=<%= next_codename %>
+Pin-Priority: 2
+
+Explanation: Debian sid
+Package: *
+Pin: release o=Debian,n=sid
+Pin-Priority: 1
+
+Explanation: Debian fallback
+Package: *
+Pin: release o=Debian
+Pin-Priority: -10
diff --git a/templates/Debian/preferences_sid.erb b/templates/Debian/preferences_sid.erb
new file mode 100644
index 0000000..3d8a45f
--- /dev/null
+++ b/templates/Debian/preferences_sid.erb
@@ -0,0 +1,9 @@
+Explanation: Debian sid
+Package: *
+Pin: release o=Debian,n=sid
+Pin-Priority: 990
+
+Explanation: Debian fallback
+Package: *
+Pin: release o=Debian
+Pin-Priority: -10
diff --git a/templates/Debian/preferences_squeeze.erb b/templates/Debian/preferences_squeeze.erb
new file mode 100644
index 0000000..f21562d
--- /dev/null
+++ b/templates/Debian/preferences_squeeze.erb
@@ -0,0 +1,24 @@
+Explanation: Debian <%= codename %>
+Package: *
+Pin: release o=Debian,n=<%= codename %>
+Pin-Priority: 990
+
+Explanation: Debian backports
+Package: *
+Pin: origin backports.debian.org
+Pin-Priority: 200
+
+Explanation: Debian wheezy
+Package: *
+Pin: release o=Debian,n=wheezy
+Pin-Priority: 2
+
+Explanation: Debian sid
+Package: *
+Pin: release o=Debian,n=sid
+Pin-Priority: 1
+
+Explanation: Debian fallback
+Package: *
+Pin: release o=Debian
+Pin-Priority: -10
diff --git a/templates/Debian/sources.list.deb-src.erb b/templates/Debian/sources.list.deb-src.erb
deleted file mode 100644
index 954e25f..0000000
--- a/templates/Debian/sources.list.deb-src.erb
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file is managed by puppet
-# all local modifications will be overwritten
-
-# basic <%= lsbdistcodename %>
-deb-src http://ftp.debian.org/debian/ <%= lsbdistcodename %> main contrib non-free
-# security suppport
-<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%>
-# There is no security mirror for <%= lsbdistcodename %>
-<% else -%>
-deb-src http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free
-<% end -%>
-
diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb
index aa26415..f2e8fd8 100644
--- a/templates/Debian/sources.list.erb
+++ b/templates/Debian/sources.list.erb
@@ -1,18 +1,84 @@
# This file is managed by puppet
# all local modifications will be overwritten
-# basic <%= lsbdistcodename %>
-deb <%= real_main_apt_source %> <%= lsbdistcodename %> main contrib non-free
-# security suppport
-<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%>
-# There is no security mirror for <%= lsbdistcodename %>
+### Debian current: <%= codename %>
+
+# basic
+deb <%= debian_url %> <%= codename %> <%= repos %>
+<% if include_src then -%>
+deb-src <%= debian_url %> <%= codename %> <%= repos %>
+<% end -%>
+
+# security
+<% if (release == "unstable" || release == "experimental") -%>
+# There is no security support for <%= release %>
+<% else -%>
+deb <%= security_url %> <%= codename %>/updates <%= repos %>
+<% if include_src then -%>
+deb-src <%= security_url %> <%= codename %>/updates <%= repos %>
+<% end -%>
+<% end -%>
+
+# backports
+<% if (release == "testing" || release == "unstable" || release == "experimental") -%>
+# There is no backports archive for <%= release %>
+<% else -%>
+deb <%= backports_url %> <%= codename %>-backports <%= repos %>
+<% if include_src then -%>
+deb-src <%= backports_url %> <%= codename %>-backports <%= repos %>
+<% end -%>
+<% end -%>
+
+<% if use_volatile -%>
+# volatile
+<% if (release == "testing" || release == "unstable" || release == "experimental") -%>
+# There is no volatile archive for <%= release %>
+<% else -%>
+deb <%= volatile_url %> <%= codename %>/volatile <%= repos %>
+<% if include_src then -%>
+deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %>
+<% end -%>
+<% end -%>
+<% end -%>
+
+<% if use_next_release then -%>
+### Debian next: <%= next_codename %>
+
+# basic
+deb <%= debian_url %> <%= next_codename %> <%= repos %>
+<% if include_src then -%>
+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/ <%= lsbdistcodename %>/updates main contrib non-free
+deb <%= security_url %> <%= next_codename %>/updates <%= repos %>
+<% if include_src then -%>
+deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %>
+<% end -%>
<% end -%>
# backports
-<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%>
-# There are no backports for for <%= lsbdistcodename %>
+<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%>
+# There is no backports archive for <%= next_release %>
<% else -%>
-deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main
+deb <%= backports_url %> <%= next_codename %>-backports <%= repos %>
+<% if include_src then -%>
+deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %>
+<% end -%>
+<% end -%>
+
+<% if use_volatile -%>
+# volatile
+<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%>
+# There is no volatile archive for <%= next_release %>
+<% else -%>
+deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %>
+<% if include_src then -%>
+deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %>
+<% end -%>
+<% end -%>
+<% end -%>
<% end -%>
diff --git a/templates/Debian/sources.list.volatile.erb b/templates/Debian/sources.list.volatile.erb
deleted file mode 100644
index 4a0d9ab..0000000
--- a/templates/Debian/sources.list.volatile.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-# This file is managed by puppet
-# all local modifications will be overwritten
-
-<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable" || lsbdistcodename == "squeeze") -%>
-# There are no backports for for <%= lsbdistcodename %>
-<% else -%>
-deb http://volatile.debian.org/debian-volatile <%= lsbdistcodename %>/volatile main contrib non-free
-<% end -%>
diff --git a/templates/Ubuntu/sources.list.backports.erb b/templates/Ubuntu/sources.list.backports.erb
deleted file mode 100644
index 8347268..0000000
--- a/templates/Ubuntu/sources.list.backports.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file is managed by puppet
-# all local modifications will be overwritten
-
-# backports
-deb http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main universe multiverse restricted
diff --git a/templates/Ubuntu/sources.list.deb-src.erb b/templates/Ubuntu/sources.list.deb-src.erb
deleted file mode 100644
index 5d85983..0000000
--- a/templates/Ubuntu/sources.list.deb-src.erb
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file is managed by puppet
-# all local modifications will be overwritten
-
-# basic <%= lsbdistcodename %>
-deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse
-
-# updates
-deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse
-
-# security suppport
-deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse
-
-
diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb
index a90c08a..81650a2 100644
--- a/templates/Ubuntu/sources.list.erb
+++ b/templates/Ubuntu/sources.list.erb
@@ -2,12 +2,25 @@
# all local modifications will be overwritten
# basic <%= lsbdistcodename %>
-deb <%= real_main_apt_source %> <%= lsbdistcodename %> main restricted universe multiverse
+deb <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %>
+<% if include_src then -%>
+deb-src <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %>
+<% end -%>
# updates
-deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse
+deb <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %>
+<% if include_src then -%>
+deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %>
+<% end -%>
# security suppport
-deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse
-
+deb <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %>
+<% if include_src then -%>
+deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %>
+<% end -%>
+# backports
+deb <%= ubuntu_url %> <%= lsbdistcodename %>-backports main <%= repos %>
+<% if include_src then -%>
+deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= repos >
+<% end -%>