From 2b2950b20e2b171c2798e1265cde62a44382616f Mon Sep 17 00:00:00 2001 From: nadir Date: Thu, 10 Dec 2009 11:00:00 +0100 Subject: added $backports_enabled for including backports repository --- templates/sources.list.backports.erb | 8 ++++++++ templates/sources.list.erb | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 templates/sources.list.backports.erb (limited to 'templates') diff --git a/templates/sources.list.backports.erb b/templates/sources.list.backports.erb new file mode 100644 index 0000000..b62f6d3 --- /dev/null +++ b/templates/sources.list.backports.erb @@ -0,0 +1,8 @@ +# This file is brought to you by puppet + +# backports +<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> +# There are no backports for for <%= lsbdistcodename %> +<% else -%> +deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main +<% end -%> diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 169d7b5..feb5603 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -9,9 +9,3 @@ deb http://ftp.debian.org/debian/ <%= lsbdistcodename %> main contrib non-free deb http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free <% end -%> -# backports -<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> -# There are no backports for for <%= lsbdistcodename %> -<% else -%> -deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main -<% end -%> -- cgit v1.2.3 From 854f3c10b09b46ef9d9fce5293dd0665b619065e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Dec 2009 17:51:49 +0100 Subject: Added apt::unattended_upgrades class, and extra template for "deb-src" --- README | 25 +++++++++++++++++++--- files/50unattended-upgrades | 43 ++++++++++++++++++++++++++++++++++++++ manifests/init.pp | 33 ++++++++++++++++++++++++++++- templates/sources.list.deb-src.erb | 11 ++++++++++ 4 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 files/50unattended-upgrades create mode 100644 templates/sources.list.deb-src.erb (limited to 'templates') diff --git a/README b/README index 8299c02..72afcfc 100644 --- a/README +++ b/README @@ -72,11 +72,30 @@ apt keyring, you can set this variable to a path in your fileserver where individual key files can be placed. If this is set and keys exist there, this module will apt-key add each key +$backports_enabled +------------------ +If set to true, the debian backports repository is enabled through a +file in /etc/apt/sources.d/. Defaults to false. + +$apt_deb_src_enabled +-------------------- +If set to true, the debian sources repository is enabled through a +file in /etc/apt/sources.d/. Defaults to false. + + Classes ======= - -This module contains only the apt class, which sets up all described -functionality. +apt +--- +Sets up the basic apt package management. + +apt::unattended_upgrades +------------------------ +Sets up the unattended-upgrades package, and configures it mostly through +the file /etc/apt/apt.conf.d/50unattended-upgrades. +Unfortunately there seems to be a bug in unattended-upgrades <= 0.25.1 that +wildcards aren't recognized, so use it with care ! +http://packages.debian.org/de/lenny/unattended-upgrades Resources diff --git a/files/50unattended-upgrades b/files/50unattended-upgrades new file mode 100644 index 0000000..06036bf --- /dev/null +++ b/files/50unattended-upgrades @@ -0,0 +1,43 @@ +// this file is managed by puppet ! +// +//See https://wiki.ubuntu.com/AutomaticUpdates for more details about this feature. + +// allowed (origin, archive) pairs +Unattended-Upgrade::Allowed-Origins { + "Debian stable"; + "Debian-Security stable"; +// "Debian testing"; +}; + +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "1"; +Unattended-Upgrade::Mail "root"; + +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 + // 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 + //2009-12-11 13:41:43,267 INFO Allowed origins are: ["['Debian', 'stable']", "['Debian-Security', 'stable']"] + //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 + + "linux-image-2.6.18-5-vserver-686"; + "linux-image-2.6.18-5-xen-vserver-686"; + "linux-image-2.6.18-6-vserver-686"; + "linux-image-2.6.18-6-xen-vserver-686"; + "linux-image-2.6.24.3"; + "linux-image-2.6.26-1-686"; + "linux-image-2.6.26-2-xen-amd64"; + "linux-image-2.6.26-2-xen-686"; + "linux-image-2.6.26-2-amd64"; +}; + diff --git a/manifests/init.pp b/manifests/init.pp index 1af6e1f..07b6c2b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,6 +3,7 @@ # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. + class apt { # See README @@ -15,6 +16,11 @@ class apt { '' => 'false', default => $backports_enabled, } + + $apt_deb_src_enabled = $apt_deb_src_enabled ? { + 'true' => 'true', + default => $apt_deb_src_enabled, + } package { apt: ensure => installed } @@ -150,7 +156,17 @@ class apt { default: { } } - + case $apt_deb_src_enabled { + 'true': { + config_file { + # deb-src + "/etc/apt/sources.list.d/debian-sources.list": + content => template("apt/sources.list.deb-src.erb"), + require => Exec[assert_lsbdistcodename]; + } + } + default: {} + } case $custom_key_dir { '': { @@ -226,3 +242,18 @@ class dselect { package { dselect: ensure => installed } } + + +class apt::unattended_upgrades { + case $operatingsystem { + debian,ubuntu: { + package { unattended-upgrades : ensure => latest; } + file { "/etc/apt/apt.conf.d/50unattended-upgrades": + source => "puppet://$server/modules/apt/50unattended-upgrades" } + } + + default: { notice "unknown operatingsystem: $operatingsystem for class apt::unattended_upgrades" } + } + +} + diff --git a/templates/sources.list.deb-src.erb b/templates/sources.list.deb-src.erb new file mode 100644 index 0000000..6811eca --- /dev/null +++ b/templates/sources.list.deb-src.erb @@ -0,0 +1,11 @@ +# This file is brought to you by puppet + +# 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 -%> + -- cgit v1.2.3 From 0c86627838c5cafbc4f6c5ecfaf389a90e0dcc20 Mon Sep 17 00:00:00 2001 From: nadir Date: Sun, 13 Dec 2009 15:14:39 +0100 Subject: added $apt_volatile_enabled, updated README --- README | 7 ++++++- manifests/init.pp | 17 ++++++++++++++++- templates/sources.list.volatile.erb | 7 +++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 templates/sources.list.volatile.erb (limited to 'templates') diff --git a/README b/README index 72afcfc..60c16a0 100644 --- a/README +++ b/README @@ -75,13 +75,18 @@ exist there, this module will apt-key add each key $backports_enabled ------------------ If set to true, the debian backports repository is enabled through a -file in /etc/apt/sources.d/. Defaults to false. +file in /etc/apt/sources.d/. Defaults to true. $apt_deb_src_enabled -------------------- If set to true, the debian sources repository is enabled through a file in /etc/apt/sources.d/. Defaults to false. +$apt_volatile_enabled +-------------------- +If set to true, the debiani volatile repository is enabled through a +file in /etc/apt/sources.d/. Defaults to false. + Classes ======= diff --git a/manifests/init.pp b/manifests/init.pp index 11f627b..4606a94 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,6 +21,11 @@ class apt { 'true' => 'true', default => $apt_deb_src_enabled, } + + $apt_volatile_enabled = $apt_volatile_enabled ? { + 'true' => 'true', + default => $apt_volatile_enabled, + } package { apt: ensure => installed } @@ -159,7 +164,6 @@ class apt { case $apt_deb_src_enabled { 'true': { config_file { - # deb-src "/etc/apt/sources.list.d/debian-sources.list": content => template("apt/sources.list.deb-src.erb"), require => Exec[assert_lsbdistcodename]; @@ -168,6 +172,17 @@ class apt { default: {} } + case $apt_volatile_enabled { + 'true': { + config_file { + "/etc/apt/sources.list.d/debian-volatile.list": + content => template("apt/sources.list.volatile.erb"), + require => Exec[assert_lsbdistcodename]; + } + } + default: {} + } + case $custom_key_dir { '': { exec { "/bin/true # no_custom_keydir": } diff --git a/templates/sources.list.volatile.erb b/templates/sources.list.volatile.erb new file mode 100644 index 0000000..06d6590 --- /dev/null +++ b/templates/sources.list.volatile.erb @@ -0,0 +1,7 @@ +# This file is brought to you by puppet + +<% 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 -%> -- cgit v1.2.3 From 5972a3556617b4a9acfb0046ee44164bf9b2f517 Mon Sep 17 00:00:00 2001 From: Varac Date: Thu, 17 Dec 2009 15:53:27 +0100 Subject: Increased Ubuntu support --- manifests/init.pp | 14 +++++++------- templates/Debian/sources.list.backports.erb | 8 ++++++++ templates/Debian/sources.list.deb-src.erb | 11 +++++++++++ templates/Debian/sources.list.erb | 11 +++++++++++ templates/Debian/sources.list.volatile.erb | 7 +++++++ templates/Ubuntu/sources.list.backports.erb | 4 ++++ templates/Ubuntu/sources.list.deb-src.erb | 12 ++++++++++++ templates/Ubuntu/sources.list.erb | 12 ++++++++++++ templates/sources.list.backports.erb | 8 -------- templates/sources.list.deb-src.erb | 11 ----------- templates/sources.list.erb | 11 ----------- templates/sources.list.volatile.erb | 7 ------- 12 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 templates/Debian/sources.list.backports.erb create mode 100644 templates/Debian/sources.list.deb-src.erb create mode 100644 templates/Debian/sources.list.erb create mode 100644 templates/Debian/sources.list.volatile.erb create mode 100644 templates/Ubuntu/sources.list.backports.erb create mode 100644 templates/Ubuntu/sources.list.deb-src.erb create mode 100644 templates/Ubuntu/sources.list.erb delete mode 100644 templates/sources.list.backports.erb delete mode 100644 templates/sources.list.deb-src.erb delete mode 100644 templates/sources.list.erb delete mode 100644 templates/sources.list.volatile.erb (limited to 'templates') diff --git a/manifests/init.pp b/manifests/init.pp index 4606a94..e459bd8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -49,7 +49,7 @@ class apt { # include main, security and backports # additional sources could be included via an array "/etc/apt/sources.list": - content => template("apt/sources.list.erb"), + content => template("apt/${operatingsystem}/sources.list.erb"), require => Exec[assert_lsbdistcodename]; } } @@ -111,8 +111,8 @@ class apt { 'true': { config_file { # backports - "/etc/apt/sources.list.d/debian-backports.list": - content => template("apt/sources.list.backports.erb"), + "/etc/apt/sources.list.d/${operatingsystem}-backports.list": + content => template("apt/${operatingsystem}/sources.list.backports.erb"), require => Exec[assert_lsbdistcodename]; } @@ -164,8 +164,8 @@ class apt { case $apt_deb_src_enabled { 'true': { config_file { - "/etc/apt/sources.list.d/debian-sources.list": - content => template("apt/sources.list.deb-src.erb"), + "/etc/apt/sources.list.d/${operatingsystem}-sources.list": + content => template("apt/${operatingsystem}/sources.list.deb-src.erb"), require => Exec[assert_lsbdistcodename]; } } @@ -175,8 +175,8 @@ class apt { case $apt_volatile_enabled { 'true': { config_file { - "/etc/apt/sources.list.d/debian-volatile.list": - content => template("apt/sources.list.volatile.erb"), + "/etc/apt/sources.list.d/${operatingsystem}-volatile.list": + content => template("apt/${operatingsystem}/sources.list.volatile.erb"), require => Exec[assert_lsbdistcodename]; } } diff --git a/templates/Debian/sources.list.backports.erb b/templates/Debian/sources.list.backports.erb new file mode 100644 index 0000000..b62f6d3 --- /dev/null +++ b/templates/Debian/sources.list.backports.erb @@ -0,0 +1,8 @@ +# This file is brought to you by puppet + +# backports +<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> +# There are no backports for for <%= lsbdistcodename %> +<% else -%> +deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main +<% end -%> diff --git a/templates/Debian/sources.list.deb-src.erb b/templates/Debian/sources.list.deb-src.erb new file mode 100644 index 0000000..6811eca --- /dev/null +++ b/templates/Debian/sources.list.deb-src.erb @@ -0,0 +1,11 @@ +# This file is brought to you by puppet + +# 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 new file mode 100644 index 0000000..feb5603 --- /dev/null +++ b/templates/Debian/sources.list.erb @@ -0,0 +1,11 @@ +# This file is brought to you by puppet + +# 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 %> +<% else -%> +deb http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free +<% end -%> + diff --git a/templates/Debian/sources.list.volatile.erb b/templates/Debian/sources.list.volatile.erb new file mode 100644 index 0000000..06d6590 --- /dev/null +++ b/templates/Debian/sources.list.volatile.erb @@ -0,0 +1,7 @@ +# This file is brought to you by puppet + +<% 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 new file mode 100644 index 0000000..66610a6 --- /dev/null +++ b/templates/Ubuntu/sources.list.backports.erb @@ -0,0 +1,4 @@ +# This file is brought to you by puppet + +# 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 new file mode 100644 index 0000000..f04de67 --- /dev/null +++ b/templates/Ubuntu/sources.list.deb-src.erb @@ -0,0 +1,12 @@ +# This file is brought to you by puppet + +# 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 new file mode 100644 index 0000000..dfecd63 --- /dev/null +++ b/templates/Ubuntu/sources.list.erb @@ -0,0 +1,12 @@ +# This file is brought to you by puppet + +# basic <%= lsbdistcodename %> +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse + +# updates +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse + +# security suppport +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse + + diff --git a/templates/sources.list.backports.erb b/templates/sources.list.backports.erb deleted file mode 100644 index b62f6d3..0000000 --- a/templates/sources.list.backports.erb +++ /dev/null @@ -1,8 +0,0 @@ -# This file is brought to you by puppet - -# backports -<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> -# There are no backports for for <%= lsbdistcodename %> -<% else -%> -deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main -<% end -%> diff --git a/templates/sources.list.deb-src.erb b/templates/sources.list.deb-src.erb deleted file mode 100644 index 6811eca..0000000 --- a/templates/sources.list.deb-src.erb +++ /dev/null @@ -1,11 +0,0 @@ -# This file is brought to you by puppet - -# 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/sources.list.erb b/templates/sources.list.erb deleted file mode 100644 index feb5603..0000000 --- a/templates/sources.list.erb +++ /dev/null @@ -1,11 +0,0 @@ -# This file is brought to you by puppet - -# 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 %> -<% else -%> -deb http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free -<% end -%> - diff --git a/templates/sources.list.volatile.erb b/templates/sources.list.volatile.erb deleted file mode 100644 index 06d6590..0000000 --- a/templates/sources.list.volatile.erb +++ /dev/null @@ -1,7 +0,0 @@ -# This file is brought to you by puppet - -<% 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 -%> -- cgit v1.2.3 From 356ff9334078198fde39fe5c8e8212109d6537a0 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Wed, 8 Sep 2010 15:39:33 -0700 Subject: backports.org has merged with the normal debian archive, the apt source changed and we don't need a separate apt-key for it now --- README | 6 +----- files/backports.org.key | 33 ------------------------------ manifests/init.pp | 39 ++---------------------------------- templates/sources.list.backports.erb | 2 +- 4 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 files/backports.org.key (limited to 'templates') diff --git a/README b/README index 1234ce2..131ae1d 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ This module manages apt on Debian. It keeps dpkg's and apt's databases as well as the keyrings for securing package download current. -backports.org is added and an archive key is provided[1]. +backports.debian.org is added. dselect is switched to expert mode to suppress superfluous help screens. @@ -139,7 +139,3 @@ 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 with high fidelity when a update should be run and when it is not needed. - - - -[1] Of course, you should check the validity of _this_ key yourself. diff --git a/files/backports.org.key b/files/backports.org.key deleted file mode 100644 index 6e66404..0000000 --- a/files/backports.org.key +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.3 (GNU/Linux) - -mQGiBEMIgw4RBADueqAzlq+rQT9JYSSWnNzo6C+9crI8lzW/fcl2Q3PO97MOQTOx -Qsf/lOh0Ku7O+VdBa+BwVPuUkSw6wTY5Ku1y/6r1BQzJ9oHkryDDJXsHzKhpdyFc -/lD4hNGqRkiNg5ulwAI0O1eqffPWDmeR9ZzSsqM40f1U4TNLfPAu1viWxwCgnbWz -onY6RqSYlRsDQaPsNTwieVEEAJeX2FGgNepD1SvfEremAkWCrYYlSZI76iTIf6bd -kGkWqIT0vJyE2MNenhDJ2ebbHJVFmL9x8S3m1daC4Zwnacm7aoCY/QgMJ+Js1Fex -Acev48W9KHgpVbFMd1t8KAwRbmFcQf0C/FZUbE7xScpTxS4z3SsMOuRyfnGpDOi6 -m/SnA/9wpquf3pPwbPykzKWNJEDouiJgt0zaFLauKDPeyTWeJ6htaAPDglArewdq -bJ9M8QgLFtzjhg/fBQlRRUk7YP4OYtp1OdPkg2D/1rPQNySWlDf21T3N/K8ydKhR -bYi+AsPuJLQUi3d+lVTFOebaL9felePvDC2/Eod7PSD1/rnkZ7Q0QmFja3BvcnRz -Lm9yZyBBcmNoaXZlIEtleSA8ZnRwLW1hc3RlckBiYWNrcG9ydHMub3JnPohGBBAR -AgAGBQJDgImkAAoJEHFe1qB+e4rJ2x4An2oI4xJpDvOx8uDIo9ihG1M0MpUqAJ9S -cqVUmiyYSPtu8MwcZecy9kmOIYheBBMRAgAeBQJDCIMOAhsDBgsJCAcDAgMVAgMD -FgIBAh4BAheAAAoJEOqOiyEWuhNsDt4AniaEBvlr4oVFMrGgPiye7iE/jv68AJ48 -OkIfwcKJt7N8ImPAboeimFvWgIheBBMRAgAeBQJDCIMOAhsDBgsJCAcDAgMVAgMD -FgIBAh4BAheAAAoJEOqOiyEWuhNsDt4AnjdB14rGa/rzz1ohwsi1oEnDRYuyAJ44 -Nv8MTPjOaeEZArQ0flg8OXwF37kCDQRDCIMREAgAzXu6DGSDAz4JH+mlthtiQwNZ -FU8bjWanGT3DL6zubxwc3ZQmRaMOiVuvJUuaJv8fdGRSvp09dP2/x5mzq2rACiEn -DwZssNSK5sigxgy2W9zeO9bOtg6bhqZLwlsL8Y2xZhyGL3qGeP4zL1QbXZ1QdJuO -90Xu7GWYS6Wsj+Y6dUsZFYvTZwSiLkEmgFUTxkNue3DQtZ/KNkwoKc+aqU+S7gDN -StQDvTNtR6IV11KbKcY1iQ0B2bkh4zShWwloIr83V6huAhfH8GA7UW6saRJAof5D -JWUb+PRmU2TAOOlyZoM4nMH+sFFDPOeG8fbecwlox5BRTMqcCB5ELbQXoVZT+wAD -BQf/ffI9R53f9USQkhsSak+k82JjRo9hqKAvPwBv3fDhMYqX3XRmwgNeax2y6Ub0 -AQkDhIC6eJILP5hTb2gjpmYYP7YE/7F1h37lUg7dDYeyPQF54mUXPnIg3uQ/V9HB -TY+ZW8rsVe1KRvPAuVFU77FfCvIFdLSXVi1HSUcGv9Y7Kk4Tkr7vzKshlcIp6zZr -O0Y3t/+ekBwTTQqEoUylVYkCSt3z6bjpVWbepkL88rbqJnPueTATw9shjbFYaND8 -cXZox9tQmlOIZ6gDeH1YvFf7ObRLxULm7C6hwik6agtXWkNABVXSxM6MB4hcP9QC -+FEhK6y/7wC3SyNRBuFujDG1aohJBBgRAgAJBQJDCIMRAhsMAAoJEOqOiyEWuhNs -VVMAoJ1gbL0PHVf7yDwMjO3HuJBErxLdAJ4v9ojJnvJu2yUl4W586soBm+wsLg== -=fBrI ------END PGP PUBLIC KEY BLOCK----- diff --git a/manifests/init.pp b/manifests/init.pp index 497077b..774f9e4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -69,44 +69,9 @@ class apt { ## This package should really always be current package { "debian-archive-keyring": ensure => latest } + # backports uses the normal archive key now + package { "debian-backports-keyring": ensure => absent } - case $lsbdistcodename { - etch: { - package { "debian-backports-keyring": ensure => latest } - - # This key was downloaded from - # http://backports.org/debian/archive.key - # and is needed to bootstrap the backports trustpath - file { "${apt_base_dir}/backports.org.key": - source => "puppet:///modules/apt/backports.org.key", - mode => 0444, owner => root, group => root, - } - exec { "/usr/bin/apt-key add ${apt_base_dir}/backports.org.key && apt-get update": - alias => "backports_key", - refreshonly => true, - subscribe => File["${apt_base_dir}/backports.org.key"], - before => [ File["apt_config"], Package["debian-backports-keyring"] ] - } - } - lenny: { - package { "debian-backports-keyring": ensure => latest } - - # This key was downloaded from - # http://backports.org/debian/archive.key - # and is needed to bootstrap the backports trustpath - file { "${apt_base_dir}/backports.org.key": - source => "puppet:///modules/apt/backports.org.key", - mode => 0444, owner => root, group => root, - } - exec { "/usr/bin/apt-key add ${apt_base_dir}/backports.org.key && apt-get update": - alias => "backports_key", - refreshonly => true, - subscribe => File["${apt_base_dir}/backports.org.key"], - before => [ Config_file["apt_config"], Package["debian-backports-keyring"] ] - } - } - } - case $custom_key_dir { '': { exec { "/bin/true # no_custom_keydir": } diff --git a/templates/sources.list.backports.erb b/templates/sources.list.backports.erb index b62f6d3..b271ca7 100644 --- a/templates/sources.list.backports.erb +++ b/templates/sources.list.backports.erb @@ -4,5 +4,5 @@ <% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> # There are no backports for for <%= lsbdistcodename %> <% else -%> -deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main +deb http://backports.debian.org/debian-backports/ <%= lsbdistcodename %>-backports main <% end -%> -- cgit v1.2.3 From e643c14ee24485b83f1d3120cf288ff14a3ae9f7 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 11:30:46 +0200 Subject: Use new variables. --- templates/sources.list.backports.erb | 6 +++--- templates/sources.list.erb | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/templates/sources.list.backports.erb b/templates/sources.list.backports.erb index b271ca7..3be0c4e 100644 --- a/templates/sources.list.backports.erb +++ b/templates/sources.list.backports.erb @@ -1,8 +1,8 @@ # This file is brought to you by puppet # backports -<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> -# There are no backports for for <%= lsbdistcodename %> +<% if (codename == "sid" || codename == "unstable") -%> +# There are no backports for for <%= codename %> <% else -%> -deb http://backports.debian.org/debian-backports/ <%= lsbdistcodename %>-backports main +deb http://backports.debian.org/debian-backports/ <%= codename %>-backports main <% end -%> diff --git a/templates/sources.list.erb b/templates/sources.list.erb index feb5603..c3453d1 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -1,11 +1,11 @@ # This file is brought to you by puppet -# basic <%= lsbdistcodename %> -deb http://ftp.debian.org/debian/ <%= lsbdistcodename %> main contrib non-free +# basic <%= codename %> +deb http://ftp.debian.org/debian/ <%= codename %> main contrib non-free # security suppport -<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> -# There is no security mirror for <%= lsbdistcodename %> +<% if (codename == "sid" || codename == "unstable") -%> +# There is no security mirror for <%= codename %> <% else -%> -deb http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free +deb http://security.debian.org/ <%= codename %>/updates main contrib non-free <% end -%> -- cgit v1.2.3 From 967df2f0104908e0fd19021158aaec8e3814188c Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 11:56:56 +0200 Subject: Really use backports as the documentation pretends. --- templates/sources.list.erb | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/templates/sources.list.erb b/templates/sources.list.erb index c3453d1..989d98d 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -1,11 +1,21 @@ # This file is brought to you by puppet -# basic <%= codename %> -deb http://ftp.debian.org/debian/ <%= codename %> main contrib non-free -# security suppport -<% if (codename == "sid" || codename == "unstable") -%> -# There is no security mirror for <%= codename %> -<% else -%> -deb http://security.debian.org/ <%= codename %>/updates main contrib non-free -<% end -%> +### Debian current: <%= codename %> + +# basic +deb <%= http://ftp.debian.org/debian/ %> <%= codename %> <%= repos %> + +# security +<% if (release == "unstable" || release == "experimental") %> +# There is no security support for <%= release %> +<% else %> +deb http://security.debian.org/ <%= codename %>/updates <%= repos %> +<% end %> + +# backports +<% 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 %> +<% end %> -- cgit v1.2.3 From de94b807ee9495d63d1afe16579bd435826e20f0 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 12:00:32 +0200 Subject: Add opt-in support for Debian Volatile. --- README | 7 +++++++ manifests/init.pp | 5 +++++ templates/sources.list.erb | 9 +++++++++ 3 files changed, 21 insertions(+) (limited to 'templates') diff --git a/README b/README index 131ae1d..22de451 100644 --- a/README +++ b/README @@ -76,6 +76,13 @@ 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_use_volatile +----------------- + +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. + Classes ======= diff --git a/manifests/init.pp b/manifests/init.pp index a211006..d79e79a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,6 +16,11 @@ class apt { require => undef, } + $use_volatile = $apt_use_volatile ? { + '' => false, + default => $apt_use_volatile, + } + # init $release, $next_release, $codename, $next_codename case $lsbdistcodename { '': { diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 989d98d..d3739ff 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -19,3 +19,12 @@ deb http://security.debian.org/ <%= codename %>/updates <%= repos %> deb http://backports.debian.org/debian-backports/ <%= codename %>-backports <%= repos %> <% end %> +<% if use_volatile %> +# volatile +<% 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 %> +<% end %> +<% end %> + -- cgit v1.2.3 From 50136de4209478cf3e266ea4fdc8b54928337a29 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 12:09:38 +0200 Subject: Add opt-in support for deb-src. --- README | 8 ++++++++ manifests/init.pp | 15 ++++++++++----- templates/sources.list.erb | 12 ++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) (limited to 'templates') diff --git a/README b/README index 22de451..b1f98c6 100644 --- a/README +++ b/README @@ -83,6 +83,14 @@ 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. + Classes ======= diff --git a/manifests/init.pp b/manifests/init.pp index d79e79a..7f52a9c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -11,16 +11,21 @@ class apt { default => $apt_clean, } - package { apt: - ensure => installed, - require => undef, - } - $use_volatile = $apt_use_volatile ? { '' => false, default => $apt_use_volatile, } + $include_src = $apt_include_src ? { + '' => false, + default => $apt_include_src, + } + + package { apt: + ensure => installed, + require => undef, + } + # init $release, $next_release, $codename, $next_codename case $lsbdistcodename { '': { diff --git a/templates/sources.list.erb b/templates/sources.list.erb index d3739ff..35fac32 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -4,12 +4,18 @@ # basic deb <%= http://ftp.debian.org/debian/ %> <%= codename %> <%= repos %> +<% if include_src then %> +deb-src <%= http://ftp.debian.org/debian/ %> <%= 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 %> +<% if include_src then %> +deb-src http://security.debian.org/ <%= codename %>/updates <%= repos %> +<% end %> <% end %> # backports @@ -17,6 +23,9 @@ deb http://security.debian.org/ <%= codename %>/updates <%= repos %> # There is no backports archive for <%= release %> <% else %> deb http://backports.debian.org/debian-backports/ <%= codename %>-backports <%= repos %> +<% if include_src then %> +deb-src http://backports.debian.org/debian-backports/ <%= codename %>-backports <%= repos %> +<% end %> <% end %> <% if use_volatile %> @@ -25,6 +34,9 @@ deb http://backports.debian.org/debian-backports/ <%= codename %>-backports <%= # There is no volatile archive for <%= release %> <% else %> deb http://volatile.debian.org/debian-volatile/ <%= codename %>/volatile <%= repos %> +<% if include_src then %> +deb-src http://volatile.debian.org/debian-volatile/ <%= codename %>/volatile <%= repos %> +<% end %> <% end %> <% end %> -- cgit v1.2.3 From 81fe80d914a2036503cd38fd5d37ad73e558ebd2 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 12:21:27 +0200 Subject: Remove unneeded template. --- templates/sources.list.backports.erb | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 templates/sources.list.backports.erb (limited to 'templates') diff --git a/templates/sources.list.backports.erb b/templates/sources.list.backports.erb deleted file mode 100644 index 3be0c4e..0000000 --- a/templates/sources.list.backports.erb +++ /dev/null @@ -1,8 +0,0 @@ -# This file is brought to you by puppet - -# backports -<% if (codename == "sid" || codename == "unstable") -%> -# There are no backports for for <%= codename %> -<% else -%> -deb http://backports.debian.org/debian-backports/ <%= codename %>-backports main -<% end -%> -- cgit v1.2.3 From ff73987f30e6566b9a89208e6b1ad96724571e0c Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 12:30:50 +0200 Subject: Add per-release preferences files. The previous default pinning preferences only supported tracking stable. Tracking squeeze or sid is now possible. --- README | 7 ++++--- manifests/default_preferences.pp | 2 +- templates/preferences.erb | 7 ------- templates/preferences_lenny.erb | 19 +++++++++++++++++++ templates/preferences_sid.erb | 9 +++++++++ templates/preferences_squeeze.erb | 19 +++++++++++++++++++ 6 files changed, 52 insertions(+), 11 deletions(-) delete mode 100644 templates/preferences.erb create mode 100644 templates/preferences_lenny.erb create mode 100644 templates/preferences_sid.erb create mode 100644 templates/preferences_squeeze.erb (limited to 'templates') diff --git a/README b/README index b1f98c6..f39007b 100644 --- a/README +++ b/README @@ -11,8 +11,9 @@ 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. @@ -54,7 +55,7 @@ $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 diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp index 3cdb355..521d2f2 100644 --- a/manifests/default_preferences.pp +++ b/manifests/default_preferences.pp @@ -2,7 +2,7 @@ class apt::default_preferences { config_file { # this just pins unstable and testing to very low values "/etc/apt/preferences": - content => template("apt/preferences.erb"), + content => template("apt/preferences_${codename}.erb"), # use File[apt_config] to reference a completed configuration # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML alias => apt_config, diff --git a/templates/preferences.erb b/templates/preferences.erb deleted file mode 100644 index ac71582..0000000 --- a/templates/preferences.erb +++ /dev/null @@ -1,7 +0,0 @@ -Package: * -Pin: release a=unstable -Pin-Priority: 1 - -Package: * -Pin: release a=testing -Pin-Priority: 2 diff --git a/templates/preferences_lenny.erb b/templates/preferences_lenny.erb new file mode 100644 index 0000000..0d7b46f --- /dev/null +++ b/templates/preferences_lenny.erb @@ -0,0 +1,19 @@ +Explanation: Debian <%= codename %> +Package: * +Pin: release o=Debian,n=<%= codename %> +Pin-Priority: 990 + +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/preferences_sid.erb b/templates/preferences_sid.erb new file mode 100644 index 0000000..3d8a45f --- /dev/null +++ b/templates/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/preferences_squeeze.erb b/templates/preferences_squeeze.erb new file mode 100644 index 0000000..9aef25a --- /dev/null +++ b/templates/preferences_squeeze.erb @@ -0,0 +1,19 @@ +Explanation: Debian <%= codename %> +Package: * +Pin: release o=Debian,n=<%= codename %> +Pin-Priority: 990 + +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 -- cgit v1.2.3 From 1183a04b4867dbd7480cd4898553c8f7f1c7688d Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 12:32:29 +0200 Subject: Track installed backports upgrades on Lenny and Squeeze. --- templates/preferences_lenny.erb | 5 +++++ templates/preferences_squeeze.erb | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'templates') diff --git a/templates/preferences_lenny.erb b/templates/preferences_lenny.erb index 0d7b46f..3de7959 100644 --- a/templates/preferences_lenny.erb +++ b/templates/preferences_lenny.erb @@ -3,6 +3,11 @@ 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 %> diff --git a/templates/preferences_squeeze.erb b/templates/preferences_squeeze.erb index 9aef25a..f21562d 100644 --- a/templates/preferences_squeeze.erb +++ b/templates/preferences_squeeze.erb @@ -3,6 +3,11 @@ 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 -- cgit v1.2.3 From 53ca6e2235accc2903d42d8aaffa1b3dd7c1130f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 12:39:50 +0200 Subject: Add opt-in support for next Debian release sources. --- README | 9 +++++++++ manifests/init.pp | 5 +++++ templates/sources.list.erb | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) (limited to 'templates') diff --git a/README b/README index f39007b..1a0fd3c 100644 --- a/README +++ b/README @@ -92,6 +92,15 @@ 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. + Classes ======= diff --git a/manifests/init.pp b/manifests/init.pp index 7f52a9c..095fe79 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,6 +21,11 @@ class apt { default => $apt_include_src, } + $use_next_release = $apt_use_next_release ? { + '' => false, + default => $apt_use_next_release, + } + package { apt: ensure => installed, require => undef, diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 35fac32..43f4a56 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -40,3 +40,44 @@ deb-src http://volatile.debian.org/debian-volatile/ <%= codename %>/volatile <%= <% end %> <% end %> +<% if use_next_release then %> +### Debian next: <%= next_codename %> + +# basic +deb <%= http://ftp.debian.org/debian/ %> <%= next_codename %> <%= repos %> +<% if include_src then %> +deb-src <%= http://ftp.debian.org/debian/ %> <%= 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 %> +<% if include_src then %> +deb-src http://security.debian.org/ <%= next_codename %>/updates <%= repos %> +<% end %> +<% end %> + +# backports +<% 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 %> +<% if include_src then %> +deb-src http://backports.debian.org/debian-backports/ <%= 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 http://volatile.debian.org/debian-volatile/ <%= next_codename %>/volatile <%= repos %> +<% if include_src then %> +deb-src http://volatile.debian.org/debian-volatile/ <%= next_codename %>/volatile <%= repos %> +<% end %> +<% end %> +<% end %> +<% end %> -- cgit v1.2.3 From 6dd66425880e2504c0583b7bf3386243d1208177 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Oct 2010 13:28:09 +0200 Subject: Bugfix. --- templates/sources.list.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'templates') diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 43f4a56..687e790 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -3,9 +3,9 @@ ### Debian current: <%= codename %> # basic -deb <%= http://ftp.debian.org/debian/ %> <%= codename %> <%= repos %> +deb http://ftp.debian.org/debian/ <%= codename %> <%= repos %> <% if include_src then %> -deb-src <%= http://ftp.debian.org/debian/ %> <%= codename %> <%= repos %> +deb-src http://ftp.debian.org/debian/ <%= codename %> <%= repos %> <% end %> # security @@ -44,9 +44,9 @@ 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 http://ftp.debian.org/debian/ <%= next_codename %> <%= repos %> <% if include_src then %> -deb-src <%= http://ftp.debian.org/debian/ %> <%= next_codename %> <%= repos %> +deb-src http://ftp.debian.org/debian/ <%= next_codename %> <%= repos %> <% end %> # security -- cgit v1.2.3 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(-) (limited to 'templates') 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 From db06babc5d095292c11445b9e76dd133943b7840 Mon Sep 17 00:00:00 2001 From: nadir Date: Sat, 9 Oct 2010 13:42:26 +0200 Subject: removed backports template in favor of main sources.list --- templates/Debian/sources.list.backports.erb | 8 -------- templates/Debian/sources.list.erb | 6 ++++++ 2 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 templates/Debian/sources.list.backports.erb (limited to 'templates') diff --git a/templates/Debian/sources.list.backports.erb b/templates/Debian/sources.list.backports.erb deleted file mode 100644 index b62f6d3..0000000 --- a/templates/Debian/sources.list.backports.erb +++ /dev/null @@ -1,8 +0,0 @@ -# This file is brought to you by puppet - -# backports -<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> -# There are no backports for for <%= lsbdistcodename %> -<% else -%> -deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main -<% end -%> diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb index feb5603..169d7b5 100644 --- a/templates/Debian/sources.list.erb +++ b/templates/Debian/sources.list.erb @@ -9,3 +9,9 @@ deb http://ftp.debian.org/debian/ <%= lsbdistcodename %> main contrib non-free deb http://security.debian.org/ <%= lsbdistcodename %>/updates main contrib non-free <% end -%> +# backports +<% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> +# There are no backports for for <%= lsbdistcodename %> +<% else -%> +deb http://www.backports.org/debian/ <%= lsbdistcodename %>-backports main +<% end -%> -- cgit v1.2.3 From 7b7fe9497ab2d465fa5ce139dda8ce6ae860e0dc Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 9 Oct 2010 21:31:25 +0200 Subject: Fix template syntax. --- templates/sources.list.erb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'templates') diff --git a/templates/sources.list.erb b/templates/sources.list.erb index c5d69e7..31a8c0e 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -3,18 +3,18 @@ ### Debian current: <%= codename %> # basic -deb <%= debian_url > <%= codename %> <%= repos %> +deb <%= debian_url %> <%= codename %> <%= repos %> <% if include_src then %> -deb-src <%= debian_url > <%= codename %> <%= repos %> +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 %> +deb <%= security_url %> <%= codename %>/updates <%= repos %> <% if include_src then %> -deb-src <%= security_url > <%= codename %>/updates <%= repos %> +deb-src <%= security_url %> <%= codename %>/updates <%= repos %> <% end %> <% end %> @@ -22,9 +22,9 @@ deb-src <%= security_url > <%= codename %>/updates <%= repos %> <% if (release == "testing" || release == "unstable" || release == "experimental") %> # There is no backports archive for <%= release %> <% else %> -deb <%= backports_url > <%= codename %>-backports <%= repos %> +deb <%= backports_url %> <%= codename %>-backports <%= repos %> <% if include_src then %> -deb-src <%= backports_url > <%= codename %>-backports <%= repos %> +deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> <% end %> <% end %> @@ -33,9 +33,9 @@ deb-src <%= backports_url > <%= codename %>-backports <%= repos %> <% if (release == "testing" || release == "unstable" || release == "experimental") %> # There is no volatile archive for <%= release %> <% else %> -deb <%= volatile_url > <%= codename %>/volatile <%= repos %> +deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> <% if include_src then %> -deb-src <%= volatile_url > <%= codename %>/volatile <%= repos %> +deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> <% end %> <% end %> <% end %> @@ -44,18 +44,18 @@ deb-src <%= volatile_url > <%= codename %>/volatile <%= repos %> ### Debian next: <%= next_codename %> # basic -deb <%= debian_url > <%= next_codename %> <%= repos %> +deb <%= debian_url %> <%= next_codename %> <%= repos %> <% if include_src then %> -deb-src <%= debian_url > <%= 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 <%= security_url > <%= next_codename %>/updates <%= repos %> +deb <%= security_url %> <%= next_codename %>/updates <%= repos %> <% if include_src then %> -deb-src <%= security_url > <%= next_codename %>/updates <%= repos %> +deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> <% end %> <% end %> @@ -63,9 +63,9 @@ deb-src <%= security_url > <%= next_codename %>/updates <%= repos %> <% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") %> # There is no backports archive for <%= next_release %> <% else %> -deb <%= backports_url > <%= next_codename %>-backports <%= repos %> +deb <%= backports_url %> <%= next_codename %>-backports <%= repos %> <% if include_src then %> -deb-src <%= backports_url > <%= next_codename %>-backports <%= repos %> +deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> <% end %> <% end %> @@ -74,9 +74,9 @@ deb-src <%= backports_url > <%= next_codename %>-backports <%= repos %> <% 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 %> +deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> <% if include_src then %> -deb-src <%= volatile_url > <%= next_codename %>/volatile <%= repos %> +deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> <% end %> <% end %> <% end %> -- cgit v1.2.3 From 1cea889f8c228d9c266c8b66717eb53e553bf527 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 10 Oct 2010 12:32:23 +0200 Subject: Trim empty lines in template. --- templates/sources.list.erb | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'templates') diff --git a/templates/sources.list.erb b/templates/sources.list.erb index 31a8c0e..cef6f91 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -4,29 +4,29 @@ # basic deb <%= debian_url %> <%= codename %> <%= repos %> -<% if include_src then %> +<% if include_src then -%> deb-src <%= debian_url %> <%= codename %> <%= repos %> -<% end %> +<% 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 %> +<% if include_src then -%> deb-src <%= security_url %> <%= codename %>/updates <%= repos %> -<% end %> -<% end %> +<% 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 %> +<% if include_src then -%> deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> -<% end %> -<% end %> +<% end -%> +<% end -%> <% if use_volatile %> # volatile @@ -34,40 +34,40 @@ deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> # There is no volatile archive for <%= release %> <% else %> deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> -<% if include_src then %> +<% if include_src then -%> deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> -<% end %> -<% end %> -<% end %> +<% end -%> +<% end -%> +<% end -%> -<% if use_next_release then %> +<% if use_next_release then -%> ### Debian next: <%= next_codename %> # basic deb <%= debian_url %> <%= next_codename %> <%= repos %> -<% if include_src then %> +<% if include_src then -%> deb-src <%= debian_url %> <%= next_codename %> <%= repos %> -<% end %> +<% end -%> # security <% if (next_release == "unstable" || next_release == "experimental") %> # There is no security support for <%= next_release %> <% else %> deb <%= security_url %> <%= next_codename %>/updates <%= repos %> -<% if include_src then %> +<% if include_src then -%> deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> -<% end %> -<% end %> +<% end -%> +<% end -%> # backports <% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") %> # There is no backports archive for <%= next_release %> <% else %> deb <%= backports_url %> <%= next_codename %>-backports <%= repos %> -<% if include_src then %> +<% if include_src then -%> deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> -<% end %> -<% end %> +<% end -%> +<% end -%> <% if use_volatile %> # volatile @@ -75,9 +75,9 @@ deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> # There is no volatile archive for <%= next_release %> <% else %> deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> -<% if include_src then %> +<% if include_src then -%> deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> -<% end %> -<% end %> -<% end %> -<% end %> +<% end -%> +<% end -%> +<% end -%> +<% end -%> -- cgit v1.2.3 From e5c40bc6f07331572c1999b086eddcd14e73dcf8 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 10 Oct 2010 12:38:18 +0200 Subject: Trim more empty lines. --- templates/sources.list.erb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'templates') diff --git a/templates/sources.list.erb b/templates/sources.list.erb index cef6f91..67da85d 100644 --- a/templates/sources.list.erb +++ b/templates/sources.list.erb @@ -9,9 +9,9 @@ deb-src <%= debian_url %> <%= codename %> <%= repos %> <% end -%> # security -<% if (release == "unstable" || release == "experimental") %> +<% if (release == "unstable" || release == "experimental") -%> # There is no security support for <%= release %> -<% else %> +<% else -%> deb <%= security_url %> <%= codename %>/updates <%= repos %> <% if include_src then -%> deb-src <%= security_url %> <%= codename %>/updates <%= repos %> @@ -19,20 +19,20 @@ deb-src <%= security_url %> <%= codename %>/updates <%= repos %> <% end -%> # backports -<% if (release == "testing" || release == "unstable" || release == "experimental") %> +<% if (release == "testing" || release == "unstable" || release == "experimental") -%> # There is no backports archive for <%= release %> -<% else %> +<% else -%> deb <%= backports_url %> <%= codename %>-backports <%= repos %> <% if include_src then -%> deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> <% end -%> <% end -%> -<% if use_volatile %> +<% if use_volatile -%> # volatile -<% if (release == "testing" || release == "unstable" || release == "experimental") %> +<% if (release == "testing" || release == "unstable" || release == "experimental") -%> # There is no volatile archive for <%= release %> -<% else %> +<% else -%> deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> <% if include_src then -%> deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> @@ -50,9 +50,9 @@ deb-src <%= debian_url %> <%= next_codename %> <%= repos %> <% end -%> # security -<% if (next_release == "unstable" || next_release == "experimental") %> +<% if (next_release == "unstable" || next_release == "experimental") -%> # There is no security support for <%= next_release %> -<% else %> +<% else -%> deb <%= security_url %> <%= next_codename %>/updates <%= repos %> <% if include_src then -%> deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> @@ -60,20 +60,20 @@ deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> <% end -%> # backports -<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") %> +<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> # There is no backports archive for <%= next_release %> -<% else %> +<% else -%> deb <%= backports_url %> <%= next_codename %>-backports <%= repos %> <% if include_src then -%> deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> <% end -%> <% end -%> -<% if use_volatile %> +<% if use_volatile -%> # volatile -<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") %> +<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> # There is no volatile archive for <%= next_release %> -<% else %> +<% else -%> deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> <% if include_src then -%> deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> -- cgit v1.2.3 From e2f80db7b76171e5945127e2fd42fb35043990fb Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 17 Oct 2010 01:35:37 +0200 Subject: Bring in a bit of Ubuntu support from Nadir. --- README | 2 + manifests/default_preferences.pp | 32 +++++++----- manifests/default_sources_list.pp | 2 +- templates/Debian/preferences_lenny.erb | 24 +++++++++ templates/Debian/preferences_sid.erb | 9 ++++ templates/Debian/preferences_squeeze.erb | 24 +++++++++ templates/Debian/sources.list.erb | 83 ++++++++++++++++++++++++++++++++ templates/Ubuntu/sources.list.erb | 22 +++++++++ templates/preferences_lenny.erb | 24 --------- templates/preferences_sid.erb | 9 ---- templates/preferences_squeeze.erb | 24 --------- templates/sources.list.erb | 83 -------------------------------- 12 files changed, 184 insertions(+), 154 deletions(-) create mode 100644 templates/Debian/preferences_lenny.erb create mode 100644 templates/Debian/preferences_sid.erb create mode 100644 templates/Debian/preferences_squeeze.erb create mode 100644 templates/Debian/sources.list.erb create mode 100644 templates/Ubuntu/sources.list.erb delete mode 100644 templates/preferences_lenny.erb delete mode 100644 templates/preferences_sid.erb delete mode 100644 templates/preferences_squeeze.erb delete mode 100644 templates/sources.list.erb (limited to 'templates') diff --git a/README b/README index d1249a0..8dafe2f 100644 --- a/README +++ b/README @@ -15,6 +15,8 @@ sources.list and apt_preferences are managed. More recent Debian releases are pinned to very low values by default to prevent accidental upgrades. +Ubuntu support is lagging behind but not absent either. + This module needs lsb-release installed. diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp index 521d2f2..605ba78 100644 --- a/manifests/default_preferences.pp +++ b/manifests/default_preferences.pp @@ -1,16 +1,22 @@ class apt::default_preferences { - config_file { - # this just pins unstable and testing to very low values - "/etc/apt/preferences": - content => template("apt/preferences_${codename}.erb"), - # use File[apt_config] to reference a completed configuration - # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML - alias => apt_config, - # only update together - require => File["/etc/apt/sources.list"]; - # little default settings which keep the system sane - "/etc/apt/apt.conf.d/from_puppet": - content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n", - before => Config_file[apt_config]; + case $operatingsystem { + 'debian': { + config_file { + "/etc/apt/preferences": + content => template("apt/${operatingsystem}/preferences_${codename}.erb"), + # use File[apt_config] to reference a completed configuration + # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML + alias => apt_config, + # only update together + require => File["/etc/apt/sources.list"]; + # little default settings which keep the system sane + "/etc/apt/apt.conf.d/from_puppet": + content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n", + before => Config_file[apt_config]; + } + } + 'ubuntu': { + notice('There is no support for default Ubuntu APT preferences') + } } } diff --git a/manifests/default_sources_list.pp b/manifests/default_sources_list.pp index 34234e3..0e78c02 100644 --- a/manifests/default_sources_list.pp +++ b/manifests/default_sources_list.pp @@ -3,7 +3,7 @@ class apt::default_sources_list { # include main, security and backports # additional sources could be included via an array "/etc/apt/sources.list": - content => template("apt/sources.list.erb"), + content => template("apt/${operatingsystem}/sources.list.erb"), } } 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.erb b/templates/Debian/sources.list.erb new file mode 100644 index 0000000..67da85d --- /dev/null +++ b/templates/Debian/sources.list.erb @@ -0,0 +1,83 @@ +# This file is brought to you by puppet + +### 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 <%= security_url %> <%= next_codename %>/updates <%= repos %> +<% if include_src then -%> +deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> +<% end -%> +<% end -%> + +# backports +<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> +# There is no backports archive for <%= next_release %> +<% else -%> +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/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb new file mode 100644 index 0000000..44f3024 --- /dev/null +++ b/templates/Ubuntu/sources.list.erb @@ -0,0 +1,22 @@ +# This file is brought to you by puppet + +# basic <%= lsbdistcodename %> +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +<% if include_src then -%> +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +<% end -%> + +# updates +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse +<% if include_src then -%> +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse +<% end -%> + +# security suppport +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse +<% if include_src then -%> +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse +<% end -%> + +# backports +deb http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main universe multiverse restricted diff --git a/templates/preferences_lenny.erb b/templates/preferences_lenny.erb deleted file mode 100644 index 3de7959..0000000 --- a/templates/preferences_lenny.erb +++ /dev/null @@ -1,24 +0,0 @@ -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/preferences_sid.erb b/templates/preferences_sid.erb deleted file mode 100644 index 3d8a45f..0000000 --- a/templates/preferences_sid.erb +++ /dev/null @@ -1,9 +0,0 @@ -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/preferences_squeeze.erb b/templates/preferences_squeeze.erb deleted file mode 100644 index f21562d..0000000 --- a/templates/preferences_squeeze.erb +++ /dev/null @@ -1,24 +0,0 @@ -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/sources.list.erb b/templates/sources.list.erb deleted file mode 100644 index 67da85d..0000000 --- a/templates/sources.list.erb +++ /dev/null @@ -1,83 +0,0 @@ -# This file is brought to you by puppet - -### 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 <%= security_url %> <%= next_codename %>/updates <%= repos %> -<% if include_src then -%> -deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> -<% end -%> -<% end -%> - -# backports -<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> -# There is no backports archive for <%= next_release %> -<% else -%> -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 -%> -- cgit v1.2.3 From b4d6f30faee423c5b544a1d44724890dcb5418a8 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 17 Oct 2010 02:01:48 +0200 Subject: Support $apt_repos for Ubuntu as well. --- manifests/init.pp | 16 +++++++++++++--- templates/Ubuntu/sources.list.erb | 16 ++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) (limited to 'templates') diff --git a/manifests/init.pp b/manifests/init.pp index 8136f25..ab90c90 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,9 +44,19 @@ class apt { '' => 'http://volatile.debian.org/debian-volatile/', default => "${apt_volatile_url}", } - $repos = $apt_repos ? { - '' => 'main contrib non-free', - default => "${apt_repos}", + 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: diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb index 36fc150..328d9e2 100644 --- a/templates/Ubuntu/sources.list.erb +++ b/templates/Ubuntu/sources.list.erb @@ -1,25 +1,25 @@ # This file is brought to you by puppet # basic <%= lsbdistcodename %> -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> <%= repos %> <% if include_src then -%> -deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> <%= repos %> <% end -%> # updates -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates <%= repos %> <% if include_src then -%> -deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates <%= repos %> <% end -%> # security suppport -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security <%= repos %> <% if include_src then -%> -deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security <%= repos %> <% end -%> # backports -deb http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main universe multiverse restricted +deb http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main <%= repos %> <% if include_src then -%> -deb-src http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main universe multiverse restricted +deb-src http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports <%= repos > <% end -%> -- cgit v1.2.3 From e42b54af40ca47ada74a4bb1e410046975b89c32 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 17 Oct 2010 10:51:06 +0200 Subject: Support choosing a custom Ubuntu mirror. --- README | 6 ++++++ manifests/init.pp | 4 ++++ templates/Ubuntu/sources.list.erb | 16 ++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/README b/README index b786b9d..8c32ca4 100644 --- a/README +++ b/README @@ -112,6 +112,12 @@ 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 ---------- diff --git a/manifests/init.pp b/manifests/init.pp index 82eb231..f3c8845 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,6 +44,10 @@ class apt { '' => '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 ? { diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb index 328d9e2..1486e95 100644 --- a/templates/Ubuntu/sources.list.erb +++ b/templates/Ubuntu/sources.list.erb @@ -1,25 +1,25 @@ # This file is brought to you by puppet # basic <%= lsbdistcodename %> -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> <%= repos %> +deb <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %> <% if include_src then -%> -deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> <%= repos %> +deb-src <%= ubuntu_url %> <%= lsbdistcodename %> <%= repos %> <% end -%> # updates -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates <%= repos %> +deb <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %> <% if include_src then -%> -deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates <%= repos %> +deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-updates <%= repos %> <% end -%> # security suppport -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security <%= repos %> +deb <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %> <% if include_src then -%> -deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security <%= repos %> +deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %> <% end -%> # backports -deb http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main <%= repos %> +deb <%= ubuntu_url %> <%= lsbdistcodename %>-backports main <%= repos %> <% if include_src then -%> -deb-src http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports <%= repos > +deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= repos > <% end -%> -- cgit v1.2.3 From ac76a5d52df78aec919f08334ca5b140902a9298 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sun, 24 Oct 2010 09:07:34 -0400 Subject: Add apt_conf_snippet and use it where possible With the new define, it's easy to add an apt.conf snippet in apt.conf.d It accepts either 'sources' to get a static file or 'content' to define content inline or with the help of a template. Put it to use where we create files in apt.conf.d Finally, fix the dependancy to the apt_config file (however, I don't see the need for this dependancy) Signed-off-by: Gabriel Filion --- files/02show_upgraded | 1 + files/03clean | 1 + manifests/apt_conf_snippet.pp | 29 +++++++++++++++++++++++++++++ manifests/init.pp | 19 +++++++++++++------ manifests/proxy-client.pp | 6 ++---- manifests/unattended_upgrades.pp | 11 ++++------- templates/20proxy.erb | 1 + 7 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 files/02show_upgraded create mode 100644 files/03clean create mode 100644 manifests/apt_conf_snippet.pp create mode 100644 templates/20proxy.erb (limited to 'templates') diff --git a/files/02show_upgraded b/files/02show_upgraded new file mode 100644 index 0000000..870a3a9 --- /dev/null +++ b/files/02show_upgraded @@ -0,0 +1 @@ +APT::Get::Show-Upgraded true; diff --git a/files/03clean b/files/03clean new file mode 100644 index 0000000..335823d --- /dev/null +++ b/files/03clean @@ -0,0 +1 @@ +DSelect::Clean auto; diff --git a/manifests/apt_conf_snippet.pp b/manifests/apt_conf_snippet.pp new file mode 100644 index 0000000..77b88ae --- /dev/null +++ b/manifests/apt_conf_snippet.pp @@ -0,0 +1,29 @@ +define apt::apt_conf_snippet( + $ensure = 'present', + $source = '', + $content = undef +){ + if $source == '' and $content == undef { + fail("One of \$source or \$content must be specified for apt_conf_snippet ${name}") + } + if $source != '' and $content != undef { + fail("Only one of \$source or \$content must specified for apt_conf_snippet ${name}") + } + + if $source { + file { "/etc/apt/apt.conf.d/${name}": + ensure => $ensure, + source => $source, + notify => Exec["refresh_apt"], + owner => root, group => 0, mode => 0600; + } + } + else { + file { "/etc/apt/apt.conf.d/${name}": + ensure => $ensure, + content => $content, + notify => Exec["refresh_apt"], + owner => root, group => 0, mode => 0600; + } + } +} diff --git a/manifests/init.pp b/manifests/init.pp index 145bba6..0e4bd5c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,7 +23,8 @@ class apt { '': { config_file { # include main, security and backports - # additional sources could be included via an array + # additional sources should be included via the custom_sources_template + # define "/etc/apt/sources.list": content => template( "apt/$operatingsystem/sources.list.erb"), require => Package['lsb']; @@ -37,11 +38,17 @@ class apt { } } - config_file { - # little default settings which keep the system sane - "/etc/apt/apt.conf.d/from_puppet": - content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n", - before => Concatenated_file['/etc/apt/preferences']; + # 01autoremove already present by default + apt_conf_snippet{ "02show_upgraded": + source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded", + "puppet:///modules/site-apt/02show_upgraded", + "puppet:///modules/apt/02show_upgraded"] + } + + apt_conf_snippet{ "03clean": + source => ["puppet:///modules/site-apt/${fqdn}/03clean", + "puppet:///modules/site-apt/03clean", + "puppet:///modules/apt/03clean"] } case $custom_preferences { diff --git a/manifests/proxy-client.pp b/manifests/proxy-client.pp index ea0a29c..30bda8a 100644 --- a/manifests/proxy-client.pp +++ b/manifests/proxy-client.pp @@ -10,9 +10,7 @@ class apt::proxy-client { 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; + apt_conf_snippet { "20proxy": + content => template("apt/20proxy.erb"), } } diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index e1080a0..6a0c685 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -4,14 +4,11 @@ class apt::unattended_upgrades { require => undef, } - config_file { - "/etc/apt/apt.conf.d/50unattended-upgrades": - source => ["puppet:///modules/site-apt/50unattended-upgrades", - "puppet:///modules/apt/50unattended-upgrades" ], + apt_conf_snippet { "50unattended-upgrades": + source => ["puppet:///modules/site-apt/50unattended-upgrades", + "puppet:///modules/apt/50unattended-upgrades" ], - # err: Could not run Puppet configuration client: Could not find dependent Config_file[apt_config] for Config_file[/etc/apt/apt.conf.d/50unattended-upgrades] at /etc/puppet/modules/apt/manifests/unattended_upgrades.pp:14 - - #before => Config_file[apt_config], + before => Concatenated_file[apt_config], require => Package['unattended-upgrades'], } } diff --git a/templates/20proxy.erb b/templates/20proxy.erb new file mode 100644 index 0000000..e72319f --- /dev/null +++ b/templates/20proxy.erb @@ -0,0 +1 @@ +Acquire::http { Proxy "http://<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; -- cgit v1.2.3 From d97a49b7b2c020c2c43df6524236f50a421789ee Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 00:14:33 -0400 Subject: refactor: simplify and remove inline content Simplifications: make apt_conf_snippet repeat less code, make code that generates sources.list more concise. Remove all inline content in favor of templates and static files. The ability to include sources for static files was needed for the main 'preferences' file, so it was added to the preferences_snippet define. Signed-off-by: Gabriel Filion --- files/preferences | 8 ++++++++ files/preferences_snippet.erb | 4 ++++ manifests/apt_conf_snippet.pp | 16 ++++++++-------- manifests/init.pp | 29 +++++++++++------------------ manifests/preferences.pp | 15 +++------------ manifests/preferences_snippet.pp | 22 +++++++++++++++++----- templates/preferences.erb | 7 ------- 7 files changed, 51 insertions(+), 50 deletions(-) create mode 100644 files/preferences create mode 100644 files/preferences_snippet.erb delete mode 100644 templates/preferences.erb (limited to 'templates') diff --git a/files/preferences b/files/preferences new file mode 100644 index 0000000..e893b7e --- /dev/null +++ b/files/preferences @@ -0,0 +1,8 @@ +Package: * +Pin: release a=unstable +Pin-Priority: 1 + +Package: * +Pin: release a=testing +Pin-Priority: 2 + diff --git a/files/preferences_snippet.erb b/files/preferences_snippet.erb new file mode 100644 index 0000000..4dfb701 --- /dev/null +++ b/files/preferences_snippet.erb @@ -0,0 +1,4 @@ +Package: <%= name %> +Pin: release a=<%= release %> +Pin-Priority: <%= priority %> + diff --git a/manifests/apt_conf_snippet.pp b/manifests/apt_conf_snippet.pp index 77b88ae..c1cd884 100644 --- a/manifests/apt_conf_snippet.pp +++ b/manifests/apt_conf_snippet.pp @@ -10,20 +10,20 @@ define apt::apt_conf_snippet( fail("Only one of \$source or \$content must specified for apt_conf_snippet ${name}") } + file { "/etc/apt/apt.conf.d/${name}": + ensure => $ensure, + notify => Exec["refresh_apt"], + owner => root, group => 0, mode => 0600; + } + if $source { - file { "/etc/apt/apt.conf.d/${name}": - ensure => $ensure, + File["/etc/apt/apt.conf.d/${name}"] { source => $source, - notify => Exec["refresh_apt"], - owner => root, group => 0, mode => 0600; } } else { - file { "/etc/apt/apt.conf.d/${name}": - ensure => $ensure, + File["/etc/apt/apt.conf.d/${name}"] { content => $content, - notify => Exec["refresh_apt"], - owner => root, group => 0, mode => 0600; } } } diff --git a/manifests/init.pp b/manifests/init.pp index 0e4bd5c..7d68303 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,23 +19,16 @@ class apt { } include lsb - case $custom_sources_list { - '': { - config_file { - # include main, security and backports - # additional sources should be included via the custom_sources_template - # define - "/etc/apt/sources.list": - content => template( "apt/$operatingsystem/sources.list.erb"), - require => Package['lsb']; - } - } - default: { - config_file { "/etc/apt/sources.list": - content => $custom_sources_list, - require => Package['lsb']; - } - } + config_file { + # include main, security and backports + # additional sources should be included via the custom_sources_template + # define + "/etc/apt/sources.list": + content => $custom_sources_list ? { + '' => template( "apt/$operatingsystem/sources.list.erb"), + default => $custom_sources_list + }, + require => Package['lsb']; } # 01autoremove already present by default @@ -109,4 +102,4 @@ class apt { # workaround for preseeded_package component file { [ "/var/cache", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory } -} +} diff --git a/manifests/preferences.pp b/manifests/preferences.pp index 772b426..5be3bd0 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -4,18 +4,9 @@ class apt::preferences { $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences" module_dir{'apt/preferences': } file{"${apt_preferences_dir}_header": - content => $custom_preferences ? { - '' => 'Package: * -Pin: release a=unstable -Pin-Priority: 1 - -Package: * -Pin: release a=testing -Pin-Priority: 2 - -', - default => $custom_preferences - }, + source => ["puppet:///modules/site-apt/${fqdn}/preferences", + "puppet:///modules/site-apt/preferences", + "puppet:///modules/apt/preferences"] } concatenated_file{'/etc/apt/preferences': diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 21dfe86..a723206 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -1,17 +1,29 @@ define apt::preferences_snippet( $ensure = 'present', + $source = '', $release, $priority ){ include apt::preferences + file { "${apt::preferences::apt_preferences_dir}/${name}": ensure => $ensure, - content => "Package: ${name} -Pin: release a=${release} -Pin-Priority: ${priority} - -", + #TODO this template is somewhat limited notify => Exec["concat_${apt::preferences::apt_preferences_dir}"], owner => root, group => 0, mode => 0600; } + + # This should really work in the same manner as sources_list and apt_conf + # snippets, but since the preferences.d directory cannot be used in Debian + # lenny, we can't generalize without going into ugly special-casing. + case $source { + '' => + File["${apt::preferences::apt_preferences_dir/${name}"] { + content => template("apt/preferences_snippet.erb") + }, + default => + File["${apt::preferences::apt_preferences_dir/${name}"] { + source => $source + } + } } diff --git a/templates/preferences.erb b/templates/preferences.erb deleted file mode 100644 index ac71582..0000000 --- a/templates/preferences.erb +++ /dev/null @@ -1,7 +0,0 @@ -Package: * -Pin: release a=unstable -Pin-Priority: 1 - -Package: * -Pin: release a=testing -Pin-Priority: 2 -- cgit v1.2.3 From 1b0bc415977c1c8b49390e0cdb1361769e0fdbae Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 01:13:44 -0400 Subject: Add file headers for awareness of puppet presence Signed-off-by: Gabriel Filion --- files/02show_upgraded | 3 +++ files/03clean | 3 +++ files/preferences | 3 +++ templates/20proxy.erb | 3 +++ templates/Debian/sources.list.deb-src.erb | 1 + templates/Debian/sources.list.erb | 1 + templates/Debian/sources.list.volatile.erb | 1 + templates/Ubuntu/sources.list.backports.erb | 1 + templates/Ubuntu/sources.list.deb-src.erb | 1 + templates/Ubuntu/sources.list.erb | 1 + 10 files changed, 18 insertions(+) (limited to 'templates') diff --git a/files/02show_upgraded b/files/02show_upgraded index 870a3a9..eb046b2 100644 --- a/files/02show_upgraded +++ b/files/02show_upgraded @@ -1 +1,4 @@ +# This file is brought to you by Puppet +# all local modifications will be overwritten + APT::Get::Show-Upgraded true; diff --git a/files/03clean b/files/03clean index 335823d..d878375 100644 --- a/files/03clean +++ b/files/03clean @@ -1 +1,4 @@ +# This file is brought to you by Puppet +# all local modifications will be overwritten + DSelect::Clean auto; diff --git a/files/preferences b/files/preferences index e893b7e..7495131 100644 --- a/files/preferences +++ b/files/preferences @@ -1,3 +1,6 @@ +# This file is brought to you by Puppet +# all local modifications will be overwritten + Package: * Pin: release a=unstable Pin-Priority: 1 diff --git a/templates/20proxy.erb b/templates/20proxy.erb index e72319f..36b26a0 100644 --- a/templates/20proxy.erb +++ b/templates/20proxy.erb @@ -1 +1,4 @@ +# This file is brought to you by Puppet +# all local modifications will be overwritten + Acquire::http { Proxy "http://<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; diff --git a/templates/Debian/sources.list.deb-src.erb b/templates/Debian/sources.list.deb-src.erb index 6811eca..e167ab6 100644 --- a/templates/Debian/sources.list.deb-src.erb +++ b/templates/Debian/sources.list.deb-src.erb @@ -1,4 +1,5 @@ # 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 diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb index 169d7b5..ab029ca 100644 --- a/templates/Debian/sources.list.erb +++ b/templates/Debian/sources.list.erb @@ -1,4 +1,5 @@ # 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 diff --git a/templates/Debian/sources.list.volatile.erb b/templates/Debian/sources.list.volatile.erb index 06d6590..d8527b6 100644 --- a/templates/Debian/sources.list.volatile.erb +++ b/templates/Debian/sources.list.volatile.erb @@ -1,4 +1,5 @@ # 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 %> diff --git a/templates/Ubuntu/sources.list.backports.erb b/templates/Ubuntu/sources.list.backports.erb index 66610a6..2bb0ad2 100644 --- a/templates/Ubuntu/sources.list.backports.erb +++ b/templates/Ubuntu/sources.list.backports.erb @@ -1,4 +1,5 @@ # 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 index f04de67..22f103b 100644 --- a/templates/Ubuntu/sources.list.deb-src.erb +++ b/templates/Ubuntu/sources.list.deb-src.erb @@ -1,4 +1,5 @@ # 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 diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb index dfecd63..a37fffc 100644 --- a/templates/Ubuntu/sources.list.erb +++ b/templates/Ubuntu/sources.list.erb @@ -1,4 +1,5 @@ # This file is brought to you by puppet +# all local modifications will be overwritten # basic <%= lsbdistcodename %> deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse -- cgit v1.2.3 From e2578c3b9820e9ff17f8a8881b8b22b5e241ee21 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 11:55:15 -0400 Subject: Add $main_apt_source Currently, it's either we use the default source that's hardcoded in the sources.list template or we redefine entirely this template. Make it easier to just change the URL of the apt source while using the rest of the default template by adding a $main_apt_source variable. Signed-off-by: Gabriel Filion --- manifests/init.pp | 8 ++++++++ templates/Debian/sources.list.erb | 2 +- templates/Ubuntu/sources.list.erb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/manifests/init.pp b/manifests/init.pp index ea187f3..8588932 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,6 +10,14 @@ class apt { 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 config_file { # include main, security and backports diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb index ab029ca..12d1027 100644 --- a/templates/Debian/sources.list.erb +++ b/templates/Debian/sources.list.erb @@ -2,7 +2,7 @@ # all local modifications will be overwritten # basic <%= lsbdistcodename %> -deb http://ftp.debian.org/debian/ <%= lsbdistcodename %> main contrib non-free +deb <%= real_main_apt_source %> <%= lsbdistcodename %> main contrib non-free # security suppport <% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable") -%> # There is no security mirror for <%= lsbdistcodename %> diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb index a37fffc..2719934 100644 --- a/templates/Ubuntu/sources.list.erb +++ b/templates/Ubuntu/sources.list.erb @@ -2,7 +2,7 @@ # all local modifications will be overwritten # basic <%= lsbdistcodename %> -deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +deb <%= real_main_apt_source %> <%= lsbdistcodename %> main restricted universe multiverse # updates deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse -- cgit v1.2.3 From 26714ae4d2992c85082ec37e6c40d725d097f79a Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 11:58:27 -0400 Subject: Include the protocol in the proxy URL The current proxy_client template makes it possible to communicate with the proxy only via HTTP. Add the protocol to the variable so that it's possible to change the protocol. Signed-off-by: Gabriel Filion --- manifests/proxy_client.pp | 2 +- templates/20proxy.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/manifests/proxy_client.pp b/manifests/proxy_client.pp index 9883933..23e9bd1 100644 --- a/manifests/proxy_client.pp +++ b/manifests/proxy_client.pp @@ -1,7 +1,7 @@ class apt::proxy_client { $real_apt_proxy = $apt_proxy ? { - "" => "localhost", + "" => "http://localhost", default => $apt_proxy } diff --git a/templates/20proxy.erb b/templates/20proxy.erb index 36b26a0..8f57e73 100644 --- a/templates/20proxy.erb +++ b/templates/20proxy.erb @@ -1,4 +1,4 @@ # This file is brought to you by Puppet # all local modifications will be overwritten -Acquire::http { Proxy "http://<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; +Acquire::http { Proxy "<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; -- cgit v1.2.3 From bd3b46ac07e36bb995c99ade2e6d045c9f06f4fc Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 25 Oct 2010 13:58:14 -0400 Subject: Change "brought to you" into "managed" in headers File headers are there to indicate that the files should not be touched directly on the server. By changing the first sentence to "This file is managed by Puppet", we reinforce the idea that it is already taken care of by something else. Signed-off-by: Gabriel Filion --- files/02show_upgraded | 2 +- files/03clean | 2 +- files/preferences | 2 +- templates/20proxy.erb | 2 +- templates/Debian/sources.list.deb-src.erb | 2 +- templates/Debian/sources.list.erb | 2 +- templates/Debian/sources.list.volatile.erb | 2 +- templates/Ubuntu/sources.list.backports.erb | 2 +- templates/Ubuntu/sources.list.deb-src.erb | 2 +- templates/Ubuntu/sources.list.erb | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'templates') diff --git a/files/02show_upgraded b/files/02show_upgraded index eb046b2..8ef5d8d 100644 --- a/files/02show_upgraded +++ b/files/02show_upgraded @@ -1,4 +1,4 @@ -# This file is brought to you by Puppet +# This file is managed by Puppet # all local modifications will be overwritten APT::Get::Show-Upgraded true; diff --git a/files/03clean b/files/03clean index d878375..29acece 100644 --- a/files/03clean +++ b/files/03clean @@ -1,4 +1,4 @@ -# This file is brought to you by Puppet +# This file is managed by Puppet # all local modifications will be overwritten DSelect::Clean auto; diff --git a/files/preferences b/files/preferences index 7495131..ddf82fe 100644 --- a/files/preferences +++ b/files/preferences @@ -1,4 +1,4 @@ -# This file is brought to you by Puppet +# This file is managed by Puppet # all local modifications will be overwritten Package: * diff --git a/templates/20proxy.erb b/templates/20proxy.erb index 8f57e73..602e08f 100644 --- a/templates/20proxy.erb +++ b/templates/20proxy.erb @@ -1,4 +1,4 @@ -# This file is brought to you by Puppet +# This file is managed by Puppet # all local modifications will be overwritten Acquire::http { Proxy "<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; diff --git a/templates/Debian/sources.list.deb-src.erb b/templates/Debian/sources.list.deb-src.erb index e167ab6..954e25f 100644 --- a/templates/Debian/sources.list.deb-src.erb +++ b/templates/Debian/sources.list.deb-src.erb @@ -1,4 +1,4 @@ -# This file is brought to you by puppet +# This file is managed by puppet # all local modifications will be overwritten # basic <%= lsbdistcodename %> diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb index 12d1027..aa26415 100644 --- a/templates/Debian/sources.list.erb +++ b/templates/Debian/sources.list.erb @@ -1,4 +1,4 @@ -# This file is brought to you by puppet +# This file is managed by puppet # all local modifications will be overwritten # basic <%= lsbdistcodename %> diff --git a/templates/Debian/sources.list.volatile.erb b/templates/Debian/sources.list.volatile.erb index d8527b6..4a0d9ab 100644 --- a/templates/Debian/sources.list.volatile.erb +++ b/templates/Debian/sources.list.volatile.erb @@ -1,4 +1,4 @@ -# This file is brought to you by puppet +# This file is managed by puppet # all local modifications will be overwritten <% if (lsbdistcodename == "sid" || lsbdistcodename == "unstable" || lsbdistcodename == "squeeze") -%> diff --git a/templates/Ubuntu/sources.list.backports.erb b/templates/Ubuntu/sources.list.backports.erb index 2bb0ad2..8347268 100644 --- a/templates/Ubuntu/sources.list.backports.erb +++ b/templates/Ubuntu/sources.list.backports.erb @@ -1,4 +1,4 @@ -# This file is brought to you by puppet +# This file is managed by puppet # all local modifications will be overwritten # backports diff --git a/templates/Ubuntu/sources.list.deb-src.erb b/templates/Ubuntu/sources.list.deb-src.erb index 22f103b..5d85983 100644 --- a/templates/Ubuntu/sources.list.deb-src.erb +++ b/templates/Ubuntu/sources.list.deb-src.erb @@ -1,4 +1,4 @@ -# This file is brought to you by puppet +# This file is managed by puppet # all local modifications will be overwritten # basic <%= lsbdistcodename %> diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb index 2719934..a90c08a 100644 --- a/templates/Ubuntu/sources.list.erb +++ b/templates/Ubuntu/sources.list.erb @@ -1,4 +1,4 @@ -# This file is brought to you by puppet +# This file is managed by puppet # all local modifications will be overwritten # basic <%= lsbdistcodename %> -- cgit v1.2.3 From 90c45cfe446588345eb5d9061ea359d121db2dc3 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Oct 2010 22:05:37 +0200 Subject: put the file at the right place & fix typos --- files/preferences_snippet.erb | 4 ---- manifests/preferences_snippet.pp | 12 +++++++----- templates/preferences_snippet.erb | 4 ++++ 3 files changed, 11 insertions(+), 9 deletions(-) delete mode 100644 files/preferences_snippet.erb create mode 100644 templates/preferences_snippet.erb (limited to 'templates') diff --git a/files/preferences_snippet.erb b/files/preferences_snippet.erb deleted file mode 100644 index 4dfb701..0000000 --- a/files/preferences_snippet.erb +++ /dev/null @@ -1,4 +0,0 @@ -Package: <%= name %> -Pin: release a=<%= release %> -Pin-Priority: <%= priority %> - diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 9da7a8e..fd2956d 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -21,13 +21,15 @@ define apt::preferences_snippet( # snippets, but since the preferences.d directory cannot be used in Debian # lenny, we can't generalize without going into ugly special-casing. case $source { - '' => - File["${apt::preferences::apt_preferences_dir/${name}"] { + '': { + File["${apt::preferences::apt_preferences_dir}/${name}"] { content => template("apt/preferences_snippet.erb") - }, - default => - File["${apt::preferences::apt_preferences_dir/${name}"] { + } + } + default: { + File["${apt::preferences::apt_preferences_dir}/${name}"] { source => $source } + } } } diff --git a/templates/preferences_snippet.erb b/templates/preferences_snippet.erb new file mode 100644 index 0000000..4dfb701 --- /dev/null +++ b/templates/preferences_snippet.erb @@ -0,0 +1,4 @@ +Package: <%= name %> +Pin: release a=<%= release %> +Pin-Priority: <%= priority %> + -- cgit v1.2.3 From ebb46ca2002d0ef9aeb15160065fa3511ced30c1 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Oct 2010 22:27:28 +0200 Subject: fixing comments apt preferences actually want // to comment, while sources are fine to be commented with # ... --- files/02show_upgraded | 4 ++-- files/03clean | 4 ++-- files/preferences | 4 ++-- templates/20proxy.erb | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/files/02show_upgraded b/files/02show_upgraded index 8ef5d8d..bb127d4 100644 --- a/files/02show_upgraded +++ b/files/02show_upgraded @@ -1,4 +1,4 @@ -# This file is managed by Puppet -# all local modifications will be overwritten +// This file is managed by Puppet +// all local modifications will be overwritten APT::Get::Show-Upgraded true; diff --git a/files/03clean b/files/03clean index 29acece..3d20924 100644 --- a/files/03clean +++ b/files/03clean @@ -1,4 +1,4 @@ -# This file is managed by Puppet -# all local modifications will be overwritten +// This file is managed by Puppet +// all local modifications will be overwritten DSelect::Clean auto; diff --git a/files/preferences b/files/preferences index ddf82fe..eea7f86 100644 --- a/files/preferences +++ b/files/preferences @@ -1,5 +1,5 @@ -# This file is managed by Puppet -# all local modifications will be overwritten +// This file is managed by Puppet +// all local modifications will be overwritten Package: * Pin: release a=unstable diff --git a/templates/20proxy.erb b/templates/20proxy.erb index 602e08f..3e1ae5d 100644 --- a/templates/20proxy.erb +++ b/templates/20proxy.erb @@ -1,4 +1,4 @@ -# This file is managed by Puppet -# all local modifications will be overwritten +// This file is managed by Puppet +// all local modifications will be overwritten Acquire::http { Proxy "<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; -- cgit v1.2.3 From ef2ebdffd25937e841be079d3aa256570ac33196 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 7 Dec 2010 22:59:58 -0500 Subject: switch to archive name for lenny default preferences the templates/Debian/preferences_lenny.erb file checked in with e2f80db7b76171e5945127e2fd42fb35043990fb contains pinning based on codename, which is not supported in lenny (see #433624 - if you look at the version graph, you see, "Fixed in version 0.7.21", and lenny has 0.7.20.2+lenny1.) --- templates/Debian/preferences_lenny.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'templates') diff --git a/templates/Debian/preferences_lenny.erb b/templates/Debian/preferences_lenny.erb index 3de7959..be8ecd8 100644 --- a/templates/Debian/preferences_lenny.erb +++ b/templates/Debian/preferences_lenny.erb @@ -1,6 +1,6 @@ Explanation: Debian <%= codename %> Package: * -Pin: release o=Debian,n=<%= codename %> +Pin: release o=Debian,a=<%= release %> Pin-Priority: 990 Explanation: Debian backports @@ -8,14 +8,14 @@ Package: * Pin: origin backports.debian.org Pin-Priority: 200 -Explanation: Debian <%= next_codename %> +Explanation: Debian <%= next_release %> Package: * -Pin: release o=Debian,n=<%= next_codename %> +Pin: release o=Debian,a=<%= next_release %> Pin-Priority: 2 Explanation: Debian sid Package: * -Pin: release o=Debian,n=sid +Pin: release o=Debian,a=unstable Pin-Priority: 1 Explanation: Debian fallback -- cgit v1.2.3 From fbb291ed19eeb9a64d4aed78c48d221315da7866 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 8 Dec 2010 22:24:24 -0500 Subject: add apticron support. Why apticron, when we have cron-apt already? Some people have different preferences, we use apticron along with the upgrade_package functionality in this module. I know someone who uses cron-apt to run the upgrades, but apticron for notifications, because apticron's notifications are much nicer (cron-apt just gives you the output of apt-get upgrade) --- README | 18 +++++++++ manifests/apticron.pp | 54 +++++++++++++++++++++++++ templates/Debian/apticron_lenny.erb | 46 +++++++++++++++++++++ templates/Debian/apticron_squeeze.erb | 75 +++++++++++++++++++++++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 manifests/apticron.pp create mode 100644 templates/Debian/apticron_lenny.erb create mode 100644 templates/Debian/apticron_squeeze.erb (limited to 'templates') diff --git a/README b/README index 109c92a..355379b 100644 --- a/README +++ b/README @@ -162,6 +162,24 @@ The apt class sets up most of the documented functionality. To use functionality that is not enabled by default, you must include one of the following classes. +apt::apticron +------------- + +When you include this class, apticron will be installed, with the following +defaults, which you are free to change before you include the class: + + $apticron_ensure_version = "present" + $apticron_email = "root" + $apticron_config = "apt/${operatingsystem}/apticron_${lsbrelease}.erb" + $apticron_diff_only = "1" + $apticron_listchanges_profile = "apticron" + $apticron_system = false + $apticron_ipaddressnum = false + $apticron_ipaddresses = false + $apticron_notifyholds = "0" + $apticron_notifynew = "0" + $apticron_customsubject = "" + apt::cron::download ------------------- diff --git a/manifests/apticron.pp b/manifests/apticron.pp new file mode 100644 index 0000000..7f834a5 --- /dev/null +++ b/manifests/apticron.pp @@ -0,0 +1,54 @@ +class apt::apticron { + + case $apticron_ensure_version { + '': { $apticron_ensure_version = "present" } + } + + case $apticron_config { + '': { $apticron_config = "apt/${operatingsystem}/apticron_${lsbrelease}.erb" } + } + + case $apticron_email { + '': { $apticron_email = "root" } + } + + case $apticron_diff_only { + '': { $apticron_diff_only = "1" } + } + + case $apticron_listchanges_profile { + '': { $apticron_listchanges_profile = "apticron" } + } + + case $apticron_system { + '': { $apticron_system = false } + } + + case $apticron_ipaddressnum { + '': { $apticron_ipaddressnum = false } + } + + case $apticron_ipaddresses { + '': { $apticron_ipaddresses = false } + } + + case $apticron_notifyholds { + '': { $apticron_notifyholds = "0" } + } + + case $apticron_notifynew { + '': { $apticron_notifynew = "0" } + } + + case $apticron_customsubject { + '': { $apticron_customsubject = "" } + } + + package { apticron: ensure => $apticron_ensure_version } + + file { "/etc/apticron/apticron.conf": + content => template($apticron_config), + mode => 0644, owner => root, group => root, + require => Package["apticron"]; + } +} diff --git a/templates/Debian/apticron_lenny.erb b/templates/Debian/apticron_lenny.erb new file mode 100644 index 0000000..9505633 --- /dev/null +++ b/templates/Debian/apticron_lenny.erb @@ -0,0 +1,46 @@ +# apticron.conf +# +# set EMAIL to a list of addresses which will be notified of impending updates +# +EMAIL="<%= apticron_email %>" + +# +# Set DIFF_ONLY to "1" to only output the difference of the current run +# compared to the last run (ie. only new upgrades since the last run). If there +# are no differences, no output/email will be generated. By default, apticron +# will output everything that needs to be upgraded. +# +DIFF_ONLY="<%= apticron_diff_only %>" + +# +# Set LISTCHANGES_PROFILE if you would like apticron to invoke apt-listchanges +# with the --profile option. You should add a corresponding profile to +# /etc/apt/listchanges.conf +# +LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" + +# +# Set SYSTEM if you would like apticron to use something other than the output +# of "hostname -f" for the system name in the mails it generates +# +# SYSTEM="foobar.example.com" +<%- if has_variable?(apticron_system) and instance_variable_get("@#{apticron_system}").to_s != "false" -%> +<%= 'SYSTEM="' + instance_variable_get("@#{apticron_system}").to_s + '"' %> + +# +# Set IPADDRESSNUM if you would like to configure the maximal number of IP +# addresses apticron displays. The default is to display 1 address of each +# family type (inet, inet6), if available. +# +# IPADDRESSNUM="1" +<%- if has_variable?(apticron_ipaddressnum) and instance_variable_get("@#{apticron_ipaddressnum}").to_s != "false" -%> +<%= 'IPADDRESSNUM="' + instance_variable_get("@#{apticron_ipaddressnum}").to_s + '"' %> + +# +# Set IPADDRESSES to a whitespace seperated list of reachable addresses for +# this system. By default, apticron will try to work these out using the +# "ip" command +# +# IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1" +<%- if has_variable?(apticron_ipaddresses) and instance_variable_get("@#{apticron_ipaddresses}").to_s != "false" -%> +<%= 'IPADDRESSES="' + instance_variable_get("@#{apticron_ipaddresses}").to_s + '"' %> diff --git a/templates/Debian/apticron_squeeze.erb b/templates/Debian/apticron_squeeze.erb new file mode 100644 index 0000000..274f14d --- /dev/null +++ b/templates/Debian/apticron_squeeze.erb @@ -0,0 +1,75 @@ +# apticron.conf +# +# set EMAIL to a space separated list of addresses which will be notified of +# impending updates +# +EMAIL="<%= apticron_email %>" + +# +# Set DIFF_ONLY to "1" to only output the difference of the current run +# compared to the last run (ie. only new upgrades since the last run). If there +# are no differences, no output/email will be generated. By default, apticron +# will output everything that needs to be upgraded. +# +DIFF_ONLY="<%= apticron_diff_only %>" + +# +# Set LISTCHANGES_PROFILE if you would like apticron to invoke apt-listchanges +# with the --profile option. You should add a corresponding profile to +# /etc/apt/listchanges.conf +# +LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" + +# +# Set SYSTEM if you would like apticron to use something other than the output +# of "hostname -f" for the system name in the mails it generates +# +# SYSTEM="foobar.example.com" +<%- if has_variable?(apticron_system) and instance_variable_get("@#{apticron_system}").to_s != "false" -%> +<%= 'SYSTEM="' + instance_variable_get("@#{apticron_system}").to_s + '"' %> + +# +# Set IPADDRESSNUM if you would like to configure the maximal number of IP +# addresses apticron displays. The default is to display 1 address of each +# family type (inet, inet6), if available. +# +# IPADDRESSNUM="1" +<%- if has_variable?(apticron_ipaddressnum) and instance_variable_get("@#{apticron_ipaddressnum}").to_s != "false" -%> +<%= 'IPADDRESSNUM="' + instance_variable_get("@#{apticron_ipaddressnum}").to_s + '"' %> + +# +# Set IPADDRESSES to a whitespace separated list of reachable addresses for +# this system. By default, apticron will try to work these out using the +# "ip" command +# +# IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1" +<%- if has_variable?(apticron_ipaddresses) and instance_variable_get("@#{apticron_ipaddresses}").to_s != "false" -%> +<%= 'IPADDRESSES="' + instance_variable_get("@#{apticron_ipaddresses}").to_s + '"' %> + +# +# Set NOTIFY_HOLDS="0" if you don't want to be notified about new versions of +# packages on hold in your system. The default behavior is downloading and +# listing them as any other package. +# +# NOTIFY_HOLDS="0" +NOTIFY_HOLDS="<%= apticron_notifyholds %>" + +# +# Set NOTIFY_NEW="0" if you don't want to be notified about packages which +# are not installed in your system. Yes, it's possible! There are some issues +# related to systems which have mixed stable/unstable sources. In these cases +# apt-get will consider for example that packages with "Priority: +# required"/"Essential: yes" in unstable but not in stable should be installed, +# so they will be listed in dist-upgrade output. Please take a look at +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531002#44 +# +# NOTIFY_NEW="0" +NOTIFY_NEW="<%= apticron_notifynew %>" + +# +# Set CUSTOM_SUBJECT if you want to replace the default subject used in +# the notification e-mails. This may help filtering/sorting client-side e-mail. +# +# CUSTOM_SUBJECT="" +CUSTOM_SUBJECT="<%= apticron_customsubject %>" + -- cgit v1.2.3 From 13bf7d0623fceb3b97cc90f0a9a9dcd8afdb03e8 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 8 Dec 2010 22:25:09 -0500 Subject: add apt-listchanges support. this is a nice compliment to using the upgrade_package functionality, because you get an email when the package has been upgraded. --- README | 13 +++++++++++ manifests/listchanges.pp | 38 ++++++++++++++++++++++++++++++++ templates/Debian/listchanges_lenny.erb | 7 ++++++ templates/Debian/listchanges_squeeze.erb | 1 + 4 files changed, 59 insertions(+) create mode 100644 manifests/listchanges.pp create mode 100644 templates/Debian/listchanges_lenny.erb create mode 120000 templates/Debian/listchanges_squeeze.erb (limited to 'templates') diff --git a/README b/README index 355379b..f171e8c 100644 --- a/README +++ b/README @@ -198,6 +198,19 @@ apt::dselect This class, when included, installs dselect and switches it to expert mode to suppress superfluous help screens. +apt::listchanges + +This class, when included, installs apt-listchanges and configures it using the +following variables, the defaults are below: + + $listchanges_version = "present" + $listchanges_config = "apt/${operatingsystem}/listchanges_${lsbrelease}.erb" + $listchanges_frontend = "pager" + $listchanges_email = "root" + $listchanges_confirm = "0" + $listchanges_saveseen = "/var/lib/apt/listchanges.db" + $listchanges_which = "both" + apt::proxy_client ----------------- diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp new file mode 100644 index 0000000..3b886bf --- /dev/null +++ b/manifests/listchanges.pp @@ -0,0 +1,38 @@ +class apt::listchanges { + + case $listchanges_version { + '': { $listchanges_version = "present" } + } + + case $listchanges_config { + '': { $listchanges_config = "apt/${operatingsystem}/listchanges_${lsbrelease}.erb" } + } + + case $listchanges_frontend { + '' { $listchanges_frontend = "pager" } + } + + case $listchanges_email { + '': { $listchanges_email = "root" } + } + + case $listchanges_confirm { + '': { $listchanges_confirm = "0" } + } + + case $listchanges_saveseen { + '': { $listchanges_saveseen = "/var/lib/apt/listchanges.db" } + } + + case $listchanges_which { + '': { $listchanges_which = "both" } + } + + package { apt-listchanges: ensure => $listchanges_ensure_version } + + file { "/etc/apt/listchanges.conf": + content => template($listchanges_config), + mode => 0644, owner => root, group => root, + require => Package["apt-listchanges"]; + } +} diff --git a/templates/Debian/listchanges_lenny.erb b/templates/Debian/listchanges_lenny.erb new file mode 100644 index 0000000..fec3b68 --- /dev/null +++ b/templates/Debian/listchanges_lenny.erb @@ -0,0 +1,7 @@ +[apt] +frontend=<%= listchanges_frontend %> +email_address=<%= listchanges_email %> +confirm=<%= listchanges_confirm %> +save_seen=<%= listchanges_saveseen %> +which=<%= listchanges_which %> + diff --git a/templates/Debian/listchanges_squeeze.erb b/templates/Debian/listchanges_squeeze.erb new file mode 120000 index 0000000..74ab496 --- /dev/null +++ b/templates/Debian/listchanges_squeeze.erb @@ -0,0 +1 @@ +listchanges_lenny.erb \ No newline at end of file -- cgit v1.2.3 From d32573ae838043978026512858d7e09c357d5166 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 8 Dec 2010 22:29:45 -0500 Subject: fix template missing <%- end -%> --- templates/Debian/apticron_lenny.erb | 3 +++ templates/Debian/apticron_squeeze.erb | 3 +++ 2 files changed, 6 insertions(+) (limited to 'templates') diff --git a/templates/Debian/apticron_lenny.erb b/templates/Debian/apticron_lenny.erb index 9505633..e484700 100644 --- a/templates/Debian/apticron_lenny.erb +++ b/templates/Debian/apticron_lenny.erb @@ -26,6 +26,7 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # SYSTEM="foobar.example.com" <%- if has_variable?(apticron_system) and instance_variable_get("@#{apticron_system}").to_s != "false" -%> <%= 'SYSTEM="' + instance_variable_get("@#{apticron_system}").to_s + '"' %> +<%- end -%> # # Set IPADDRESSNUM if you would like to configure the maximal number of IP @@ -35,6 +36,7 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # IPADDRESSNUM="1" <%- if has_variable?(apticron_ipaddressnum) and instance_variable_get("@#{apticron_ipaddressnum}").to_s != "false" -%> <%= 'IPADDRESSNUM="' + instance_variable_get("@#{apticron_ipaddressnum}").to_s + '"' %> +<%- end -%> # # Set IPADDRESSES to a whitespace seperated list of reachable addresses for @@ -44,3 +46,4 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1" <%- if has_variable?(apticron_ipaddresses) and instance_variable_get("@#{apticron_ipaddresses}").to_s != "false" -%> <%= 'IPADDRESSES="' + instance_variable_get("@#{apticron_ipaddresses}").to_s + '"' %> +<%- end -%> \ No newline at end of file diff --git a/templates/Debian/apticron_squeeze.erb b/templates/Debian/apticron_squeeze.erb index 274f14d..3b8c9fd 100644 --- a/templates/Debian/apticron_squeeze.erb +++ b/templates/Debian/apticron_squeeze.erb @@ -27,6 +27,7 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # SYSTEM="foobar.example.com" <%- if has_variable?(apticron_system) and instance_variable_get("@#{apticron_system}").to_s != "false" -%> <%= 'SYSTEM="' + instance_variable_get("@#{apticron_system}").to_s + '"' %> +<%- end %> # # Set IPADDRESSNUM if you would like to configure the maximal number of IP @@ -36,6 +37,7 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # IPADDRESSNUM="1" <%- if has_variable?(apticron_ipaddressnum) and instance_variable_get("@#{apticron_ipaddressnum}").to_s != "false" -%> <%= 'IPADDRESSNUM="' + instance_variable_get("@#{apticron_ipaddressnum}").to_s + '"' %> +<%- end -%> # # Set IPADDRESSES to a whitespace separated list of reachable addresses for @@ -45,6 +47,7 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1" <%- if has_variable?(apticron_ipaddresses) and instance_variable_get("@#{apticron_ipaddresses}").to_s != "false" -%> <%= 'IPADDRESSES="' + instance_variable_get("@#{apticron_ipaddresses}").to_s + '"' %> +<%- end -%> # # Set NOTIFY_HOLDS="0" if you don't want to be notified about new versions of -- cgit v1.2.3 From c67abe8d167ddc3435c444a44206243e983efea0 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 9 Dec 2010 09:48:38 -0500 Subject: fix compile syntax error in ubuntu sources.list, closes #2639 --- templates/Ubuntu/sources.list.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb index 81650a2..b5725f5 100644 --- a/templates/Ubuntu/sources.list.erb +++ b/templates/Ubuntu/sources.list.erb @@ -22,5 +22,5 @@ deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-security <%= repos %> # backports deb <%= ubuntu_url %> <%= lsbdistcodename %>-backports main <%= repos %> <% if include_src then -%> -deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= repos > +deb-src <%= ubuntu_url %> <%= lsbdistcodename %>-backports <%= repos %> <% end -%> -- cgit v1.2.3 From 248d7e46ff1506050f3bffb0d462da37e139729e Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 11 Dec 2010 19:58:19 +0100 Subject: Bypass default APT proxy to access bugs.debian.org. This is needed when using apt-listbugs with an APT proxy that only {wants,can} proxy "normal" APT traffic. --- templates/20proxy.erb | 1 + 1 file changed, 1 insertion(+) (limited to 'templates') diff --git a/templates/20proxy.erb b/templates/20proxy.erb index 3e1ae5d..fd0c7fe 100644 --- a/templates/20proxy.erb +++ b/templates/20proxy.erb @@ -2,3 +2,4 @@ // all local modifications will be overwritten Acquire::http { Proxy "<%= real_apt_proxy %>:<%= real_apt_proxy_port %>"; }; +Acquire::HTTP::Proxy::bugs.debian.org "DIRECT"; -- cgit v1.2.3 From 4103a2705498b4e6d371af5582df74c93f6e7e2d Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 12 Dec 2010 09:43:40 +0100 Subject: Additionally use version number in Lenny default pinning. Lenny's APT does not support pinning like this: Pin: release o=Debian,n=<%= codename %> We therefore switched (in commit ef2ebdffd) to: Pin: release o=Debian,a=<%= release %> With such a pinning setup, when Squeeze is released, systems using this module with $apt_use_next_release set to true would immediately switch to prefer packages from Squeeze. If an automated upgrade process is setup, they would be automatically upgraded to Squeeze. This does not sound safe to me, so let's use the release version number as an additional selection criterion to prevent upgrades to Squeeze to happen behind our back: Pin: release o=Debian,a=<%= release %>,v=<%= release_version %>* Note that the trailing '*' is intentional and necessary to match stable point-releases. --- lib/puppet/parser/functions/debian_release_version.rb | 9 +++++++++ manifests/init.pp | 3 ++- templates/Debian/preferences_lenny.erb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lib/puppet/parser/functions/debian_release_version.rb (limited to 'templates') diff --git a/lib/puppet/parser/functions/debian_release_version.rb b/lib/puppet/parser/functions/debian_release_version.rb new file mode 100644 index 0000000..4b135d0 --- /dev/null +++ b/lib/puppet/parser/functions/debian_release_version.rb @@ -0,0 +1,9 @@ +module Puppet::Parser::Functions + newfunction(:debian_release_version, :type => :rvalue) do |args| + case args[0] + when 'etch' then '4.0' + when 'lenny' then '5.0' + else '' + end + end +end diff --git a/manifests/init.pp b/manifests/init.pp index 2d46ad4..7fa811d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -62,7 +62,7 @@ class apt { include lsb - # init $release, $next_release, $codename, $next_codename + # init $release, $next_release, $codename, $next_codename, $release_version case $lsbdistcodename { '': { $codename = $lsbdistcodename @@ -73,6 +73,7 @@ class apt { $release = debian_release($codename) } } + $release_version = debian_release_version($codename) $next_codename = debian_nextcodename($codename) $next_release = debian_nextrelease($release) diff --git a/templates/Debian/preferences_lenny.erb b/templates/Debian/preferences_lenny.erb index be8ecd8..dda2d7a 100644 --- a/templates/Debian/preferences_lenny.erb +++ b/templates/Debian/preferences_lenny.erb @@ -1,6 +1,6 @@ Explanation: Debian <%= codename %> Package: * -Pin: release o=Debian,a=<%= release %> +Pin: release o=Debian,a=<%= release %>,v=<%= release_version %>* Pin-Priority: 990 Explanation: Debian backports -- cgit v1.2.3 From 5237f9dab0480ed7eb064826c6e92d315dabaddc Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 15 Dec 2010 14:49:34 -0500 Subject: change $listchanges_* to $apt_listchanges, not nice to clutter up the namespace like that --- manifests/listchanges.pp | 18 +++++++++--------- templates/Debian/listchanges_lenny.erb | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'templates') diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp index 347717e..04cbc52 100644 --- a/manifests/listchanges.pp +++ b/manifests/listchanges.pp @@ -1,37 +1,37 @@ class apt::listchanges { - case $listchanges_version { + case $apt_listchanges_version { '': { $listchanges_version = "present" } } - case $listchanges_config { + case $apt_listchanges_config { '': { $listchanges_config = "apt/${operatingsystem}/listchanges_${lsbdistcodename}.erb" } } - case $listchanges_frontend { + case $apt_listchanges_frontend { '': { $listchanges_frontend = "mail" } } - case $listchanges_email { + case $apt_listchanges_email { '': { $listchanges_email = "root" } } - case $listchanges_confirm { + case $apt_listchanges_confirm { '': { $listchanges_confirm = "0" } } - case $listchanges_saveseen { + case $apt_listchanges_saveseen { '': { $listchanges_saveseen = "/var/lib/apt/listchanges.db" } } - case $listchanges_which { + case $apt_listchanges_which { '': { $listchanges_which = "both" } } - package { apt-listchanges: ensure => $listchanges_ensure_version } + package { apt-listchanges: ensure => $apt_listchanges_ensure_version } file { "/etc/apt/listchanges.conf": - content => template($listchanges_config), + content => template($apt_listchanges_config), mode => 0644, owner => root, group => root, require => Package["apt-listchanges"]; } diff --git a/templates/Debian/listchanges_lenny.erb b/templates/Debian/listchanges_lenny.erb index fec3b68..3624b39 100644 --- a/templates/Debian/listchanges_lenny.erb +++ b/templates/Debian/listchanges_lenny.erb @@ -1,7 +1,7 @@ [apt] -frontend=<%= listchanges_frontend %> -email_address=<%= listchanges_email %> -confirm=<%= listchanges_confirm %> -save_seen=<%= listchanges_saveseen %> -which=<%= listchanges_which %> +frontend=<%= apt_listchanges_frontend %> +email_address=<%= apt_listchanges_email %> +confirm=<%= apt_listchanges_confirm %> +save_seen=<%= apt_listchanges_saveseen %> +which=<%= apt_listchanges_which %> -- cgit v1.2.3 From 67dc9a22597342d999ec450333fbd44608547442 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 15 Dec 2010 15:46:20 -0500 Subject: fix apticron template --- templates/Debian/apticron_lenny.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'templates') diff --git a/templates/Debian/apticron_lenny.erb b/templates/Debian/apticron_lenny.erb index e484700..9ec1c6d 100644 --- a/templates/Debian/apticron_lenny.erb +++ b/templates/Debian/apticron_lenny.erb @@ -24,8 +24,8 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # of "hostname -f" for the system name in the mails it generates # # SYSTEM="foobar.example.com" -<%- if has_variable?(apticron_system) and instance_variable_get("@#{apticron_system}").to_s != "false" -%> -<%= 'SYSTEM="' + instance_variable_get("@#{apticron_system}").to_s + '"' %> +<%- if has_variable?('apticron_system') and instance_variable_get("@#{'apticron_system'}").to_s != "false" -%> +<%= 'SYSTEM="' + instance_variable_get("@#{'apticron_system'}").to_s + '"' %> <%- end -%> # @@ -34,8 +34,8 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # family type (inet, inet6), if available. # # IPADDRESSNUM="1" -<%- if has_variable?(apticron_ipaddressnum) and instance_variable_get("@#{apticron_ipaddressnum}").to_s != "false" -%> -<%= 'IPADDRESSNUM="' + instance_variable_get("@#{apticron_ipaddressnum}").to_s + '"' %> +<%- if has_variable?('apticron_ipaddressnum') and instance_variable_get("@#{'apticron_ipaddressnum'}").to_s != "false" -%> +<%= 'IPADDRESSNUM="' + instance_variable_get("@#{'apticron_ipaddressnum'}").to_s + '"' %> <%- end -%> # @@ -44,6 +44,6 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # "ip" command # # IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1" -<%- if has_variable?(apticron_ipaddresses) and instance_variable_get("@#{apticron_ipaddresses}").to_s != "false" -%> -<%= 'IPADDRESSES="' + instance_variable_get("@#{apticron_ipaddresses}").to_s + '"' %> +<%- if has_variable?('apticron_ipaddresses') and instance_variable_get("@#{'apticron_ipaddresses'}").to_s != "false" -%> +<%= 'IPADDRESSES="' + instance_variable_get("@#{'apticron_ipaddresses'}").to_s + '"' %> <%- end -%> \ No newline at end of file -- cgit v1.2.3 From c0377ca7377ed9ab19e319996e7ec5ad3c179070 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 15 Dec 2010 22:20:08 +0100 Subject: Apply fix from 67dc9a22 to Squeeze template as well. --- templates/Debian/apticron_squeeze.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'templates') diff --git a/templates/Debian/apticron_squeeze.erb b/templates/Debian/apticron_squeeze.erb index 3b8c9fd..b0aa975 100644 --- a/templates/Debian/apticron_squeeze.erb +++ b/templates/Debian/apticron_squeeze.erb @@ -25,9 +25,9 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # of "hostname -f" for the system name in the mails it generates # # SYSTEM="foobar.example.com" -<%- if has_variable?(apticron_system) and instance_variable_get("@#{apticron_system}").to_s != "false" -%> -<%= 'SYSTEM="' + instance_variable_get("@#{apticron_system}").to_s + '"' %> -<%- end %> +<%- if has_variable?('apticron_system') and instance_variable_get("@#{'apticron_system'}").to_s != "false" -%> +<%= 'SYSTEM="' + instance_variable_get("@#{'apticron_system'}").to_s + '"' %> +<%- end -%> # # Set IPADDRESSNUM if you would like to configure the maximal number of IP @@ -35,8 +35,8 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # family type (inet, inet6), if available. # # IPADDRESSNUM="1" -<%- if has_variable?(apticron_ipaddressnum) and instance_variable_get("@#{apticron_ipaddressnum}").to_s != "false" -%> -<%= 'IPADDRESSNUM="' + instance_variable_get("@#{apticron_ipaddressnum}").to_s + '"' %> +<%- if has_variable?('apticron_ipaddressnum') and instance_variable_get("@#{'apticron_ipaddressnum'}").to_s != "false" -%> +<%= 'IPADDRESSNUM="' + instance_variable_get("@#{'apticron_ipaddressnum'}").to_s + '"' %> <%- end -%> # @@ -45,8 +45,8 @@ LISTCHANGES_PROFILE="<%= apticron_listchanges_profile %>" # "ip" command # # IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1" -<%- if has_variable?(apticron_ipaddresses) and instance_variable_get("@#{apticron_ipaddresses}").to_s != "false" -%> -<%= 'IPADDRESSES="' + instance_variable_get("@#{apticron_ipaddresses}").to_s + '"' %> +<%- if has_variable?('apticron_ipaddresses') and instance_variable_get("@#{'apticron_ipaddresses'}").to_s != "false" -%> +<%= 'IPADDRESSES="' + instance_variable_get("@#{'apticron_ipaddresses'}").to_s + '"' %> <%- end -%> # -- cgit v1.2.3 From e19b574e23f8bd591609b4108eea5e42ee8eafd9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 7 Feb 2011 11:17:07 +0100 Subject: Starting from Squeeze, Debian Volatile is deprecated in favor of CODENAME-updates. Take this into account in the Debian sources.list template: - go on using volatile.d.o for <= Lenny sources lines - start using CODENAME-updates for Squeeze and newer. Reference: http://lists.debian.org/debian-volatile/2011/01/msg00008.html --- README | 4 +++- templates/Debian/sources.list.erb | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/README b/README index 61ffb1d..6489272 100644 --- a/README +++ b/README @@ -112,7 +112,9 @@ Here's an example of setting the proxy to 'http://proxy.domain' at port 666: $apt_volatile_enabled ----------------- -If this variable is set to true the Debian Volatile sources are added. +If this variable is set to true the Debian Volatile sources (until +Lenny) or CODENAME-updates (such as squeeze-updates, supported since +Squeeze) are added. By default this is false for backward compatibility with older versions of this module. diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb index f2e8fd8..3a810e3 100644 --- a/templates/Debian/sources.list.erb +++ b/templates/Debian/sources.list.erb @@ -34,10 +34,17 @@ deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> <% if (release == "testing" || release == "unstable" || release == "experimental") -%> # There is no volatile archive for <%= release %> <% else -%> +<% if (codename == "lenny" || codename == "etch") -%> deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> <% if include_src then -%> deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> <% end -%> +<% else -%> +deb <%= debian_url %> <%= codename %>-updates <%= repos %> +<% if include_src then -%> +deb-src <%= debian_url %> <%= codename %>-updates <%= repos %> +<% end -%> +<% end -%> <% end -%> <% end -%> @@ -75,10 +82,17 @@ deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> <% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> # There is no volatile archive for <%= next_release %> <% else -%> +<% if (next_codename == "lenny" || next_codename == "etch") -%> deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> <% if include_src then -%> deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> <% end -%> +<% else -%> +deb <%= debian_url %> <%= next_codename %>-updates <%= repos %> +<% if include_src then -%> +deb-src <%= debian_url %> <%= next_codename %>-updates <%= repos %> +<% end -%> +<% end -%> <% end -%> <% end -%> <% end -%> -- cgit v1.2.3 From 045e1fc748c83b55ce03c5cb2aa0a8ae29904975 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 7 Feb 2011 11:40:00 +0100 Subject: Stop hard-coding Wheezy name in Squeeze's pinning template. Every needed function has been updated since Squeeze was released and we can thus use a nice generic template. --- templates/Debian/preferences_squeeze.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/Debian/preferences_squeeze.erb b/templates/Debian/preferences_squeeze.erb index f21562d..3de7959 100644 --- a/templates/Debian/preferences_squeeze.erb +++ b/templates/Debian/preferences_squeeze.erb @@ -8,9 +8,9 @@ Package: * Pin: origin backports.debian.org Pin-Priority: 200 -Explanation: Debian wheezy +Explanation: Debian <%= next_codename %> Package: * -Pin: release o=Debian,n=wheezy +Pin: release o=Debian,n=<%= next_codename %> Pin-Priority: 2 Explanation: Debian sid -- cgit v1.2.3