diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/default_preferences.pp | 12 | ||||
-rw-r--r-- | manifests/init.pp | 27 | ||||
-rw-r--r-- | manifests/preferences.pp | 31 | ||||
-rw-r--r-- | manifests/preferences/absent.pp | 8 | ||||
-rw-r--r-- | manifests/preferences_snippet.pp | 17 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 2 |
6 files changed, 67 insertions, 30 deletions
diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp deleted file mode 100644 index 4752fad..0000000 --- a/manifests/default_preferences.pp +++ /dev/null @@ -1,12 +0,0 @@ -class apt::default_preferences { - config_file { - # this just pins unstable and testing to very low values - "/etc/apt/preferences": - content => template("apt/preferences.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"]; - } -} diff --git a/manifests/init.pp b/manifests/init.pp index 60c95a1..4db120d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,25 +33,15 @@ class apt { # 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]; + before => Concatenated_file['/etc/apt/preferences']; } case $custom_preferences { - '': { - include apt::default_preferences - } false: { - config_file { "/etc/apt/preferences": - alias => "apt_config", - ensure => absent; - } + include apt::preferences::absent } default: { - config_file { "/etc/apt/preferences": - content => $custom_preferences, - alias => "apt_config", - require => File["/etc/apt/sources.list"]; - } + include apt::preferences } } @@ -70,11 +60,13 @@ class apt { 'refresh_apt': command => '/usr/bin/apt-get update && sleep 1', refreshonly => true, - subscribe => [ File["/etc/apt/sources.list", "/etc/apt/preferences", "/etc/apt/apt.conf.d"], - Config_file["apt_config"] ]; + subscribe => File['/etc/apt/sources.list', + '/etc/apt/apt.conf.d', + '/etc/apt/preferences']; 'update_apt': command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean', - require => [ File["/etc/apt/sources.list", "/etc/apt/preferences"], Config_file["apt_config"] ], + require => File['/etc/apt/sources.list', + '/etc/apt/preferences'], loglevel => info, # Another Semaphor for all packages to reference alias => "apt_updated"; @@ -82,6 +74,7 @@ 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 } @@ -95,7 +88,7 @@ class apt { alias => "custom_keys", subscribe => File["${apt_base_dir}/keys.d"], refreshonly => true, - before => Config_file["apt_config"]; + before => Concatenated_file[apt_config]; } } diff --git a/manifests/preferences.pp b/manifests/preferences.pp new file mode 100644 index 0000000..772b426 --- /dev/null +++ b/manifests/preferences.pp @@ -0,0 +1,31 @@ +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": + content => $custom_preferences ? { + '' => 'Package: * +Pin: release a=unstable +Pin-Priority: 1 + +Package: * +Pin: release a=testing +Pin-Priority: 2 + +', + default => $custom_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 + alias => apt_config, + # only update together + require => File["/etc/apt/sources.list"]; + } + +} diff --git a/manifests/preferences/absent.pp b/manifests/preferences/absent.pp new file mode 100644 index 0000000..3131aff --- /dev/null +++ b/manifests/preferences/absent.pp @@ -0,0 +1,8 @@ +class apt::preferences::absent { + include common::moduledir + $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences" + concatenated_file{'/etc/apt/preferences': + dir => $apt_preferences_dir, + ensure => absent, + } +} diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp new file mode 100644 index 0000000..21dfe86 --- /dev/null +++ b/manifests/preferences_snippet.pp @@ -0,0 +1,17 @@ +define apt::preferences_snippet( + $ensure = 'present', + $release, + $priority +){ + include apt::preferences + file { "${apt::preferences::apt_preferences_dir}/${name}": + ensure => $ensure, + content => "Package: ${name} +Pin: release a=${release} +Pin-Priority: ${priority} + +", + notify => Exec["concat_${apt::preferences::apt_preferences_dir}"], + owner => root, group => 0, mode => 0600; + } +} diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index c984c40..9a6c13b 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -9,7 +9,7 @@ class apt::unattended_upgrades { content => 'APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1"; ', - before => Config_file[apt_config], + before => Concatenated_file[apt_config], require => Package['unattended-upgrades'], } } |