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 --- README | 3 + manifests/init.pp | 108 +++++++++++++++++++++-------------- templates/sources.list.backports.erb | 8 +++ templates/sources.list.erb | 6 -- 4 files changed, 75 insertions(+), 50 deletions(-) create mode 100644 templates/sources.list.backports.erb diff --git a/README b/README index c6e6c4e..8299c02 100644 --- a/README +++ b/README @@ -1,3 +1,6 @@ +forked from https://labs.riseup.net/code/projects/show/module-apt + + Overview ======== diff --git a/manifests/init.pp b/manifests/init.pp index 96ab2db..1af6e1f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -11,6 +11,11 @@ class apt { default => $apt_clean, } + $backports_enabled = $backports_enabled ? { + '' => 'false', + default => $backports_enabled, + } + package { apt: ensure => installed } # a few templates need lsbdistcodename @@ -85,53 +90,68 @@ class apt { # Another Semaphor for all packages to reference alias => apt_updated; } + + ## This package should really always be current + package { "debian-archive-keyring": + ensure => latest, + } - ## This package should really always be current - package { "debian-archive-keyring": - ensure => latest, - } - - 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://$server/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://$server/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"] ] - } - } + case $backports_enabled { + 'true': { + config_file { + # backports + "/etc/apt/sources.list.d/debian-backports.list": + content => template("apt/sources.list.backports.erb"), + require => Exec[assert_lsbdistcodename]; + } + + 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://$server/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://$server/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"] ] + } + } + } + + } + default: { } } + + case $custom_key_dir { '': { exec { "/bin/true # no_custom_keydir": } 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 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 a066eabfd1919d8ac94b28302c1f915ec84ae57d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Dec 2009 18:04:26 +0100 Subject: cleaned 50unattended_upgrades --- files/50unattended-upgrades | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/files/50unattended-upgrades b/files/50unattended-upgrades index 06036bf..37c587c 100644 --- a/files/50unattended-upgrades +++ b/files/50unattended-upgrades @@ -30,14 +30,19 @@ Unattended-Upgrade::Package-Blacklist { //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"; + # lenny + "linux-image-2.6.26-1-686"; + "linux-image-2.6.26-1-amd64"; + "linux-image-2.6.26-1-xen-686"; + "linux-image-2.6.26-1-xen-amd64"; + "linux-image-2.6.26-1-vserver-686"; + "linux-image-2.6.26-1-vserver-amd64"; + + "linux-image-2.6.26-2-686"; "linux-image-2.6.26-2-amd64"; + "linux-image-2.6.26-2-xen-686"; + "linux-image-2.6.26-2-xen-amd64"; + "linux-image-2.6.26-2-vserver-amd64"; + }; -- cgit v1.2.3 From dc3a7e41c648a4975ee117a161c59e4678ffff3f Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Dec 2009 21:46:42 +0100 Subject: fixed typo --- files/50unattended-upgrades | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/50unattended-upgrades b/files/50unattended-upgrades index 37c587c..384b373 100644 --- a/files/50unattended-upgrades +++ b/files/50unattended-upgrades @@ -30,7 +30,7 @@ Unattended-Upgrade::Package-Blacklist { //2009-12-11 13:41:45,233 INFO Writing dpkg log to '/var/log/unattended-upgrades-dpkg_2009-12-11_13:41:45.233713.log' //2009-12-11 13:42:11,988 INFO All upgrades installed - # lenny + // lenny "linux-image-2.6.26-1-686"; "linux-image-2.6.26-1-amd64"; "linux-image-2.6.26-1-xen-686"; -- cgit v1.2.3 From 1c491fecdaa31b0729de4cbcfac431829851b989 Mon Sep 17 00:00:00 2001 From: nadir Date: Fri, 11 Dec 2009 22:01:16 +0100 Subject: cleaned init.pp --- manifests/init.pp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 07b6c2b..11f627b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -245,15 +245,8 @@ class dselect { 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" } - } - + package { unattended-upgrades : ensure => latest; } + file { "/etc/apt/apt.conf.d/50unattended-upgrades": + source => "puppet://$server/modules/apt/50unattended-upgrades" } } -- 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 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 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 e95ac6b120f9d43e4b8c1dccd0badd1ced3b1fee Mon Sep 17 00:00:00 2001 From: nadir Date: Wed, 17 Feb 2010 13:54:05 +0100 Subject: added apt::custom_sources_template to deploy custom sources.list.d/xyz.list from templates --- README | 6 ++++++ manifests/init.pp | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README b/README index 60c16a0..9968c03 100644 --- a/README +++ b/README @@ -146,6 +146,12 @@ upgrade_package { "perl": "perl-modules": } +apt::custom_sources_template +---------------------------- +Deploys custom sources in /etc/apt/sources.list.d, i.e. + + apt::custom_sources_template { "site-apt/my-repository.list.erb": sources_file => "my-repository.list" } + TODO ==== diff --git a/manifests/init.pp b/manifests/init.pp index e459bd8..9a59e0c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -53,8 +53,19 @@ class apt { require => Exec[assert_lsbdistcodename]; } } - - case $custom_preferences { + + define custom_sources_template ($sources_file = "") { + file { "/etc/apt/sources.list.d/$sources_file": + content => template($name), + require => Exec[assert_lsbdistcodename]; + } + exec { "/usr/bin/apt-get update": + subscribe => File["/etc/apt/sources.list.d/$sources_file"], + refreshonly => true, + } + } + + case $custom_preferences { '': { include default_preferences } -- cgit v1.2.3 From 3dc9ec415b24b57e721a6cf8392511da98b011ee Mon Sep 17 00:00:00 2001 From: nadir Date: Wed, 24 Feb 2010 13:55:06 +0100 Subject: Moved apt-get update and -autoclean to a seperate, optional cronjob in order to fasten the puppetrun and to decrease the I/O of embedded devices --- README | 4 ++++ manifests/init.pp | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/README b/README index 9968c03..5f990f5 100644 --- a/README +++ b/README @@ -102,6 +102,10 @@ 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 +apt::cron +--------- +Deploys a cronjob to run apt-get update && apt-get autoclean every hour + Resources ========= diff --git a/manifests/init.pp b/manifests/init.pp index 9a59e0c..2d05722 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -106,13 +106,8 @@ class apt { subscribe => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File["/etc/apt/apt.conf.d"], File[apt_config] ]; - "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly": - require => [ File["/etc/apt/sources.list"], - File["/etc/apt/preferences"], File[apt_config] ], - # Another Semaphor for all packages to reference - alias => apt_updated; } - + ## This package should really always be current package { "debian-archive-keyring": ensure => latest, @@ -270,9 +265,17 @@ class dselect { } -class apt::unattended_upgrades { +class apt::unattended_upgrades inherits apt { package { unattended-upgrades : ensure => latest; } file { "/etc/apt/apt.conf.d/50unattended-upgrades": source => "puppet://$server/modules/apt/50unattended-upgrades" } } +class apt::cron inherits apt { + file {'/etc/cron.d/apt.cron': + source => undef, + content => "# by puppet\n3 * * * * root /usr/bin/apt-get update && /usr/bin/apt-get autoclean\n", + notify => service["crond"]; + } +} + -- cgit v1.2.3 From 5952611119d839eea1e4b39be1c89fa2e5cae502 Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 15 Jul 2010 21:22:24 +0200 Subject: fixed unclomplete merge with riseups master --- manifests/init.pp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 87668fd..0606182 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -113,25 +113,12 @@ class apt { ensure => latest, } -<<<<<<< HEAD - ## This package should really always be current - package { "debian-archive-keyring": - ensure => latest, - } - -======= ->>>>>>> riseup/master case $backports_enabled { 'true': { config_file { # backports -<<<<<<< HEAD "/etc/apt/sources.list.d/${operatingsystem}-backports.list": content => template("apt/${operatingsystem}/sources.list.backports.erb"), -======= - "/etc/apt/sources.list.d/debian-backports.list": - content => template("apt/sources.list.backports.erb"), ->>>>>>> riseup/master require => Exec[assert_lsbdistcodename]; } @@ -180,7 +167,6 @@ class apt { default: { } } -<<<<<<< HEAD case $apt_deb_src_enabled { 'true': { config_file { @@ -202,9 +188,6 @@ class apt { } default: {} } -======= - ->>>>>>> riseup/master case $custom_key_dir { '': { -- cgit v1.2.3 From 521ccfec19d40fa5d78162727afa26c15778c173 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 15 Sep 2010 22:31:42 +0200 Subject: improve decision handling, remove unnecessary exec --- manifests/init.pp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index af860f7..78ae6c5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -110,27 +110,20 @@ class apt { } } - case $custom_key_dir { - '': { - exec { "/bin/true # no_custom_keydir": } + if $custom_key_dir { + file { "${apt_base_dir}/keys.d": + source => "$custom_key_dir", + recurse => true, + mode => 0755, owner => root, group => root, } - default: { - file { "${apt_base_dir}/keys.d": - source => "$custom_key_dir", - recurse => true, - mode => 0755, owner => root, group => root, - } - exec { "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update": - alias => "custom_keys", - subscribe => File["${apt_base_dir}/keys.d"], - refreshonly => true, - before => Config_file[apt_config]; - } + exec { "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update": + alias => "custom_keys", + subscribe => File["${apt_base_dir}/keys.d"], + refreshonly => true, + before => Config_file[apt_config]; } } # workaround for preseeded_package component - file { "/var/cache": ensure => directory } - file { "/var/cache/local": ensure => directory } - file { "/var/cache/local/preseeding": ensure => directory } + file { [ "/var/cache", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory } } -- cgit v1.2.3 From 32d230c62c20f11d6d079ad53a446d61183c4a3d Mon Sep 17 00:00:00 2001 From: nadir Date: Sat, 9 Oct 2010 13:36:30 +0200 Subject: files in /etc/apt/apt.conf.d should be numbered --- manifests/default_preferences.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp index 3cdb355..671abdd 100644 --- a/manifests/default_preferences.pp +++ b/manifests/default_preferences.pp @@ -9,7 +9,7 @@ class apt::default_preferences { # only update together require => File["/etc/apt/sources.list"]; # little default settings which keep the system sane - "/etc/apt/apt.conf.d/from_puppet": + "/etc/apt/apt.conf.d/99from_puppet": content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n", before => Config_file[apt_config]; } -- cgit v1.2.3 From 9fa9bfd9d8c5df468ee8f39a6d951947f7b9d1c5 Mon Sep 17 00:00:00 2001 From: nadir Date: Sat, 9 Oct 2010 13:39:39 +0200 Subject: added possibility to have a custom 50unattended-upgrades --- manifests/unattended_upgrades.pp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index c984c40..27942b3 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -5,11 +5,11 @@ class apt::unattended_upgrades { } config_file { - "/etc/apt/apt.conf.d/unattended_upgrades": - content => 'APT::Periodic::Update-Package-Lists "1"; -APT::Periodic::Unattended-Upgrade "1"; -', - before => Config_file[apt_config], - require => Package['unattended-upgrades'], + "/etc/apt/apt.conf.d/50unattended-upgrades": + source => ["puppet:///modules/site-apt/50unattended-upgrades", + "puppet:///modules/apt/50unattended-upgrades" ], + + before => Config_file[apt_config], + require => Package['unattended-upgrades'], } } -- cgit v1.2.3 From ed9263cd3dbb6ada17d2ac56a4fb5198f54bac85 Mon Sep 17 00:00:00 2001 From: nadir Date: Sat, 9 Oct 2010 13:41:23 +0200 Subject: distribution specific sources.list.erb --- manifests/default_sources_list.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/default_sources_list.pp b/manifests/default_sources_list.pp index 7db6535..cf7d523 100644 --- a/manifests/default_sources_list.pp +++ b/manifests/default_sources_list.pp @@ -4,7 +4,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"), require => Package['lsb']; } } -- 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 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 eae01000c1db8bcfa7de17b2a9a8370289b801bc Mon Sep 17 00:00:00 2001 From: nadir Date: Sat, 9 Oct 2010 14:39:11 +0200 Subject: re-added apt::custom_sources_template to deploy custom sources.list.d/xyz.list --- manifests/custom_sources.pp | 10 ++++++++++ manifests/init.pp | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 manifests/custom_sources.pp diff --git a/manifests/custom_sources.pp b/manifests/custom_sources.pp new file mode 100644 index 0000000..cd7b8fc --- /dev/null +++ b/manifests/custom_sources.pp @@ -0,0 +1,10 @@ +define apt::custom_sources_template ($sources_file = "") { + file { "/etc/apt/sources.list.d/$sources_file": + content => template($name), + } + exec { "/usr/bin/apt-get update": + subscribe => File["/etc/apt/sources.list.d/$sources_file"], + refreshonly => true, + } + } + diff --git a/manifests/init.pp b/manifests/init.pp index 78ae6c5..9c33b4d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,6 +5,8 @@ class apt { + import "custom_sources.pp" + # See README $real_apt_clean = $apt_clean ? { '' => 'auto', -- cgit v1.2.3