diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/apt_conf.pp | 7 | ||||
-rw-r--r-- | manifests/cron/dist_upgrade.pp (renamed from manifests/cron/dist-upgrade.pp) | 2 | ||||
-rw-r--r-- | manifests/dist_upgrade/initiator.pp | 4 | ||||
-rw-r--r-- | manifests/dot_d_directories.pp | 22 | ||||
-rw-r--r-- | manifests/init.pp | 33 | ||||
-rw-r--r-- | manifests/preferences.pp | 16 | ||||
-rw-r--r-- | manifests/preferences_snippet.pp | 37 | ||||
-rw-r--r-- | manifests/preseeded_package.pp | 2 | ||||
-rw-r--r-- | manifests/sources_list.pp | 8 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 6 |
10 files changed, 87 insertions, 50 deletions
diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp index c484ec3..fe07546 100644 --- a/manifests/apt_conf.pp +++ b/manifests/apt_conf.pp @@ -12,10 +12,15 @@ define apt::apt_conf( fail("Only one of \$source or \$content must specified for apt_conf ${name}") } + include apt::dot_d_directories + + # One would expect the 'file' resource on sources.list.d to trigger an + # apt-get update when files are added or modified in the directory, but it + # apparently doesn't. file { "/etc/apt/apt.conf.d/${name}": ensure => $ensure, + owner => root, group => 0, mode => 0644, notify => Exec["refresh_apt"], - owner => root, group => 0, mode => 0644; } if $source { diff --git a/manifests/cron/dist-upgrade.pp b/manifests/cron/dist_upgrade.pp index 2568cb7..1c8adb1 100644 --- a/manifests/cron/dist-upgrade.pp +++ b/manifests/cron/dist_upgrade.pp @@ -1,4 +1,4 @@ -class apt::cron::dist-upgrade inherits apt::cron::base { +class apt::cron::dist_upgrade inherits apt::cron::base { $action = "autoclean -y dist-upgrade -y -o APT::Get::Show-Upgraded=true -o 'DPkg::Options::=--force-confold' diff --git a/manifests/dist_upgrade/initiator.pp b/manifests/dist_upgrade/initiator.pp index 6d57947..571cd51 100644 --- a/manifests/dist_upgrade/initiator.pp +++ b/manifests/dist_upgrade/initiator.pp @@ -10,8 +10,8 @@ class apt::dist_upgrade::initiator inherits apt::dist_upgrade { path => "${initiator_abs}", checksum => md5, source => [ - "puppet:///modules/site-apt/${fqdn}/${initiator}", - "puppet:///modules/site-apt/${initiator}", + "puppet:///modules/site_apt/${fqdn}/${initiator}", + "puppet:///modules/site_apt/${initiator}", "puppet:///modules/apt/${initiator}", ], } diff --git a/manifests/dot_d_directories.pp b/manifests/dot_d_directories.pp new file mode 100644 index 0000000..742aad4 --- /dev/null +++ b/manifests/dot_d_directories.pp @@ -0,0 +1,22 @@ +class apt::dot_d_directories { + + # watch .d directories and ensure they are present + file { + "/etc/apt/apt.conf.d": + ensure => directory, + checksum => mtime, + notify => Exec['refresh_apt']; + "/etc/apt/sources.list.d": + ensure => directory, + checksum => mtime, + notify => Exec['refresh_apt']; + } + + exec { + # "&& sleep 1" is workaround for older(?) clients + 'refresh_apt': + command => '/usr/bin/apt-get update && sleep 1', + refreshonly => true, + } + +} diff --git a/manifests/init.pp b/manifests/init.pp index b5be91f..2ae691f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -85,27 +85,28 @@ class apt { '' => template( "apt/$operatingsystem/sources.list.erb"), default => $custom_sources_list }, - require => Package['lsb']; + require => Package['lsb'], + notify => Exec['refresh_apt'], } apt_conf { "02show_upgraded": - source => [ "puppet:///modules/site-apt/${fqdn}/02show_upgraded", - "puppet:///modules/site-apt/02show_upgraded", + source => [ "puppet:///modules/site_apt/${fqdn}/02show_upgraded", + "puppet:///modules/site_apt/02show_upgraded", "puppet:///modules/apt/02show_upgraded" ] } if ( $virtual == "vserver" ) { apt_conf { "03clean_vserver": - source => [ "puppet:///modules/site-apt/${fqdn}/03clean_vserver", - "puppet:///modules/site-apt/03clean_vserver", + source => [ "puppet:///modules/site_apt/${fqdn}/03clean_vserver", + "puppet:///modules/site_apt/03clean_vserver", "puppet:///modules/apt/03clean_vserver" ], alias => "03clean"; } } else { apt_conf { "03clean": - source => [ "puppet:///modules/site-apt/${fqdn}/03clean", - "puppet:///modules/site-apt/03clean", + source => [ "puppet:///modules/site_apt/${fqdn}/03clean", + "puppet:///modules/site_apt/03clean", "puppet:///modules/apt/03clean" ] } } @@ -128,21 +129,7 @@ class apt { require => [ Apt_conf['02show_upgraded'], Apt_conf['03clean'] ]; } - # watch .d directories and ensure they are present - file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; } - file { "/etc/apt/sources.list.d": - ensure => directory, - checksum => mtime, - notify => Exec['refresh_apt'], - } - - exec { - # "&& sleep 1" is workaround for older(?) clients - 'refresh_apt': - command => '/usr/bin/apt-get update && sleep 1', - refreshonly => true, - subscribe => [ File['/etc/apt/apt.conf.d'], Config_file['/etc/apt/sources.list'] ]; - } + include apt::dot_d_directories ## This package should really always be current package { "debian-archive-keyring": ensure => latest } @@ -167,7 +154,7 @@ class apt { } if $custom_preferences != false { Exec["custom_keys"] { - before => Concatenated_file[apt_config], + before => Concat[apt_config], } } } diff --git a/manifests/preferences.pp b/manifests/preferences.pp index 71ef0a6..f188149 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -1,9 +1,6 @@ class apt::preferences { - include common::moduledir - $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences" - module_dir{'apt/preferences': } - file { "${apt_preferences_dir}_header": + concat::fragment{"apt_preferences_header": content => $custom_preferences ? { '' => $operatingsystem ? { 'debian' => template("apt/${operatingsystem}/preferences_${codename}.erb"), @@ -11,16 +8,15 @@ class apt::preferences { }, default => $custom_preferences }, + order => 00, + target => '/etc/apt/preferences', } - concatenated_file { '/etc/apt/preferences': - dir => $apt_preferences_dir, - header => "${apt_preferences_dir}_header", - # use Concatenated_file[apt_config] to reference a completed configuration - # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML + concat{'/etc/apt/preferences': alias => apt_config, # only update together - require => File["/etc/apt/sources.list"]; + require => File["/etc/apt/sources.list"], + owner => root, group => 0, mode => 0644; } } diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 4b8e575..6a8e6bc 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -1,21 +1,33 @@ define apt::preferences_snippet( + $package = false, $ensure = 'present', $source = '', - $release, + $release = '', + $pin = '', $priority ) { + $real_package = $package ? { + false => $name, + default => $package, + } + if $custom_preferences == false { fail("Trying to define a preferences_snippet with \$custom_preferences set to false.") } + if !$pin and !$release { + fail("apt::preferences_snippet requires one of the 'pin' or 'release' argument to be set") + } + if $pin and $release { + fail("apt::preferences_snippet requires either a 'pin' or 'release' argument, not both") + } + include apt::preferences - file { "${apt::preferences::apt_preferences_dir}/${name}": + concat::fragment{"apt_preference_${name}": ensure => $ensure, - #TODO this template is somewhat limited - notify => Exec["concat_${apt::preferences::apt_preferences_dir}"], - owner => root, group => 0, mode => 0600; + target => '/etc/apt/preferences', } # This should really work in the same manner as sources_list and apt_conf @@ -23,12 +35,21 @@ define apt::preferences_snippet( # 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") + case $release { + '': { + Concat::Fragment["apt_preference_${name}"]{ + content => template("apt/preferences_snippet.erb") + } + } + default: { + Concat::Fragment["apt_preference_${name}"]{ + content => template("apt/preferences_snippet_release.erb") + } + } } } default: { - File["${apt::preferences::apt_preferences_dir}/${name}"] { + Concat::Fragment["apt_preference_${name}"]{ source => $source } } diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp index 839f200..d831934 100644 --- a/manifests/preseeded_package.pp +++ b/manifests/preseeded_package.pp @@ -1,7 +1,7 @@ define apt::preseeded_package ($content = "", $ensure = "installed") { $seedfile = "/var/cache/local/preseeding/$name.seeds" $real_content = $content ? { - "" => template ( "site-apt/$lsbdistcodename/$name.seeds" ), + "" => template ( "site_apt/$lsbdistcodename/$name.seeds" ), default => $content } diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp index 86b35a7..499116d 100644 --- a/manifests/sources_list.pp +++ b/manifests/sources_list.pp @@ -11,9 +11,15 @@ define apt::sources_list ( fail("Only one of \$source or \$content must specified for apt_sources_snippet ${name}") } + include apt::dot_d_directories + + # One would expect the 'file' resource on sources.list.d to trigger an + # apt-get update when files are added or modified in the directory, but it + # apparently doesn't. file { "/etc/apt/sources.list.d/${name}": ensure => $ensure, - owner => root, group => 0, mode => 0644; + owner => root, group => 0, mode => 0644, + notify => Exec['refresh_apt'], } if $source { diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index 1732fe2..23d9bd7 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -6,8 +6,8 @@ class apt::unattended_upgrades { } apt_conf { "50unattended-upgrades": - source => ["puppet:///modules/site-apt/$lsbdistcodename/50unattended-upgrades", - "puppet:///modules/site-apt/50unattended-upgrades", + source => ["puppet:///modules/site_apt/$lsbdistcodename/50unattended-upgrades", + "puppet:///modules/site_apt/50unattended-upgrades", "puppet:///modules/apt/$lsbdistcodename/50unattended-upgrades", "puppet:///modules/apt/50unattended-upgrades" ], require => Package['unattended-upgrades'], @@ -15,7 +15,7 @@ class apt::unattended_upgrades { if $custom_preferences != false { Apt_conf["50unattended-upgrades"] { - before => Concatenated_file[apt_config], + before => Concat[apt_config], } } |