aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README88
-rw-r--r--files/50unattended-upgrades19
-rw-r--r--files/preferences11
-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.pp96
-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, 415 insertions, 98 deletions
diff --git a/README b/README
index a6e37ce..12ec3fa 100644
--- a/README
+++ b/README
@@ -11,10 +11,16 @@ backports.debian.org is added.
dselect is switched to expert mode to suppress superfluous help screens.
-sources.list and apt_preferences are managed. Testing and unstable are pinned to
-very low values by default to prevent accidental upgrades.
+sources.list and 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.
+
+This module needs:
+
+- lsb-release installed
+- the common module: git://labs.riseup.net/shared-common
Variables
@@ -43,18 +49,17 @@ 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
--------------------
By default this module will use a basic apt/preferences file with
-unstable and testing pinned to very low values so that any package
+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. You can set this
variable to pull in a customized apt/preferences template, for
@@ -80,11 +85,68 @@ If this variable is set to true apt::unattended_upgrades is included,
which will install the package unattended-upgrades and configure it to
daily upgrade the system.
+$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
=======
-This module contains only the apt class, which sets up all described
-functionality.
+apt
+---
+
+The apt class sets up all documented functionality but cron-apt.
+
+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.
Defines
=======
@@ -150,8 +212,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/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 7495131..0000000
--- a/files/preferences
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is brought to you by Puppet
-# all local modifications will be overwritten
-
-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 7d68303..6938c2c 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -13,12 +13,77 @@ class apt {
default => $apt_clean,
}
+ $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,
}
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)
+
config_file {
# include main, security and backports
# additional sources should be included via the custom_sources_template
@@ -31,7 +96,6 @@ class apt {
require => Package['lsb'];
}
- # 01autoremove already present by default
apt_conf_snippet{ "02show_upgraded":
source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded",
"puppet:///modules/site-apt/02show_upgraded",
@@ -53,6 +117,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'],
+ ],
+ }
+
if $apt_unattended_upgrades {
include apt::unattended_upgrades
}
@@ -68,16 +143,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 e167ab6..0000000
--- a/templates/Debian/sources.list.deb-src.erb
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file is brought to you 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 ab029ca..7fb9bdf 100644
--- a/templates/Debian/sources.list.erb
+++ b/templates/Debian/sources.list.erb
@@ -1,18 +1,84 @@
# This file is brought to you by puppet
# all local modifications will be overwritten
-# basic <%= lsbdistcodename %>
-deb http://ftp.debian.org/debian/ <%= 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 d8527b6..0000000
--- a/templates/Debian/sources.list.volatile.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-# This file is brought to you 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 2bb0ad2..0000000
--- a/templates/Ubuntu/sources.list.backports.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file is brought to you 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 22f103b..0000000
--- a/templates/Ubuntu/sources.list.deb-src.erb
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file is brought to you 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 a37fffc..2a25d6f 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 http://de.archive.ubuntu.com/ubuntu <%= 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 -%>