From 802e591a25f8627c28d691b3408eb504c74feb97 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 14:17:02 -0500 Subject: update modules path to the new 0.25 required layout --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index f8d7e4a..96ab2db 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -101,7 +101,7 @@ class apt { # http://backports.org/debian/archive.key # and is needed to bootstrap the backports trustpath file { "${apt_base_dir}/backports.org.key": - source => "puppet://$servername/apt/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": @@ -120,7 +120,7 @@ class apt { # http://backports.org/debian/archive.key # and is needed to bootstrap the backports trustpath file { "${apt_base_dir}/backports.org.key": - source => "puppet://$servername/apt/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": -- cgit v1.2.3 From c1694ae3372352d975d5f49b4c2fd0e12e8e827e Mon Sep 17 00:00:00 2001 From: Varac Date: Thu, 10 Dec 2009 11:00:00 +0100 Subject: added $backports_enabled for including backports repository --- manifests/init.pp | 108 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 44 deletions(-) (limited to 'manifests') 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": } -- cgit v1.2.3 From 92fd1d13513d2cec5ea95652b7b0c5fa0f6b1111 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 2 Sep 2010 19:14:23 -0400 Subject: quote all aliases to be consistent --- manifests/init.pp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index af860f7..0116ff8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -36,7 +36,7 @@ class apt { default: { config_file { "/etc/apt/preferences": content => $custom_preferences, - alias => apt_config, + alias => "apt_config", require => File["/etc/apt/sources.list"]; } } @@ -60,14 +60,14 @@ class apt { subscribe => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File["/etc/apt/apt.conf.d"], - Config_file[apt_config] ]; + Config_file["apt_config"] ]; 'update_apt': command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean', require => [ File["/etc/apt/sources.list"], - File["/etc/apt/preferences"], Config_file[apt_config] ], + File["/etc/apt/preferences"], Config_file["apt_config"] ], loglevel => info, # Another Semaphor for all packages to reference - alias => apt_updated; + alias => "apt_updated"; } ## This package should really always be current @@ -88,7 +88,7 @@ class apt { alias => "backports_key", refreshonly => true, subscribe => File["${apt_base_dir}/backports.org.key"], - before => [ File[apt_config], Package["debian-backports-keyring"] ] + before => [ File["apt_config"], Package["debian-backports-keyring"] ] } } lenny: { @@ -105,7 +105,7 @@ class apt { alias => "backports_key", refreshonly => true, subscribe => File["${apt_base_dir}/backports.org.key"], - before => [ Config_file[apt_config], Package["debian-backports-keyring"] ] + before => [ Config_file["apt_config"], Package["debian-backports-keyring"] ] } } } @@ -124,7 +124,7 @@ class apt { alias => "custom_keys", subscribe => File["${apt_base_dir}/keys.d"], refreshonly => true, - before => Config_file[apt_config]; + before => Config_file["apt_config"]; } } } -- cgit v1.2.3 From cb9e265ad23178d47970e28458b8a426d9400d92 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 2 Sep 2010 19:15:47 -0400 Subject: clean up the multiple File subscribes --- manifests/init.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 0116ff8..497077b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -57,14 +57,11 @@ class apt { 'refresh_apt': command => '/usr/bin/apt-get update && sleep 1', refreshonly => true, - subscribe => [ File["/etc/apt/sources.list"], - File["/etc/apt/preferences"], - File["/etc/apt/apt.conf.d"], + subscribe => [ File["/etc/apt/sources.list", "/etc/apt/preferences", "/etc/apt/apt.conf.d"], Config_file["apt_config"] ]; 'update_apt': command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean', - require => [ File["/etc/apt/sources.list"], - File["/etc/apt/preferences"], Config_file["apt_config"] ], + require => [ File["/etc/apt/sources.list", "/etc/apt/preferences"], Config_file["apt_config"] ], loglevel => info, # Another Semaphor for all packages to reference alias => "apt_updated"; -- 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 --- manifests/init.pp | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) (limited to 'manifests') 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": } -- cgit v1.2.3 From ebcda455df36aefac48bb831192f2b4e7af8fafc Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sun, 17 Oct 2010 20:36:45 -0400 Subject: Make $apt_clean effective in all cases The file "/etc/apt/apt.conf.d/from_puppet" is currently only defined when $custom_sources_list is not used (it is declared in default_preferences). Bring this file up in the apt class so that using custom sources doesn't remove its addition. Signed-off-by: Gabriel Filion --- manifests/default_preferences.pp | 4 ---- manifests/init.pp | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp index 3cdb355..4752fad 100644 --- a/manifests/default_preferences.pp +++ b/manifests/default_preferences.pp @@ -8,9 +8,5 @@ class apt::default_preferences { 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]; } } diff --git a/manifests/init.pp b/manifests/init.pp index 98ec91c..9ef1cea 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,6 +29,13 @@ 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 => Config_file[apt_config]; + } + case $custom_preferences { '': { include apt::default_preferences -- cgit v1.2.3 From 8175bff077112fc7b1397f082f1fbac56474feb8 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sun, 17 Oct 2010 20:42:09 -0400 Subject: Add a proxy-client class The module currently doesn't have a handy way of making a server get its packages via a proxy. Add a "proxy-client" class that makes this easy. $apt_proxy declares the proxy server's fqdn $apt_proxy_port declares the port used for connection Signed-off-by: Gabriel Filion --- manifests/proxy-client.pp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 manifests/proxy-client.pp (limited to 'manifests') diff --git a/manifests/proxy-client.pp b/manifests/proxy-client.pp new file mode 100644 index 0000000..ea0a29c --- /dev/null +++ b/manifests/proxy-client.pp @@ -0,0 +1,18 @@ +class apt::proxy-client { + + $real_apt_proxy = $apt_proxy ? { + "" => "localhost", + default => $apt_proxy + } + + $real_apt_proxy_port = $apt_proxy_port ? { + "" => "3142", + 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; + } +} -- cgit v1.2.3 From 973657848100d227c10f4b51a23bf24a56550c8d Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 18 Oct 2010 01:43:24 -0400 Subject: Remove unnecessary exec When $custom_key_dir has not been assigned any value, a useless exec of /bin/true is run. Remove this by using 'if' instead of 'case'. Signed-off-by: Gabriel Filion --- manifests/init.pp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 9ef1cea..57a685c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -78,26 +78,21 @@ class apt { package { "debian-archive-keyring": ensure => latest } # backports uses the normal archive key now package { "debian-backports-keyring": ensure => absent } - - 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", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory } -} +} -- cgit v1.2.3 From 4dbcd092817708292de6463777b331c8dbc7e727 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 18 Oct 2010 01:45:22 -0400 Subject: Make it possible to ensure preferences is absent The current code makes it mandatory to have a file /etc/apt/preferences present. In the event that this file is empty or contains a space, apt-get update cannot execute. Add a case with the special value "false" that ensures the file does not exist. Signed-off-by: Gabriel Filion --- manifests/init.pp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 57a685c..60c95a1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -40,6 +40,12 @@ class apt { '': { include apt::default_preferences } + false: { + config_file { "/etc/apt/preferences": + alias => "apt_config", + ensure => absent; + } + } default: { config_file { "/etc/apt/preferences": content => $custom_preferences, -- cgit v1.2.3