diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/cron/base.pp | 3 | ||||
-rw-r--r-- | manifests/cron/dist-upgrade.pp | 21 | ||||
-rw-r--r-- | manifests/cron/download.pp | 21 | ||||
-rw-r--r-- | manifests/custom_sources.pp | 4 | ||||
-rw-r--r-- | manifests/default_preferences.pp | 32 | ||||
-rw-r--r-- | manifests/default_sources_list.pp | 3 | ||||
-rw-r--r-- | manifests/init.pp | 113 | ||||
-rw-r--r-- | manifests/preseeded_package.pp | 4 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 8 |
9 files changed, 137 insertions, 72 deletions
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp new file mode 100644 index 0000000..2cfbefb --- /dev/null +++ b/manifests/cron/base.pp @@ -0,0 +1,3 @@ +class apt::cron::base { + package { cron-apt: ensure => installed } +} diff --git a/manifests/cron/dist-upgrade.pp b/manifests/cron/dist-upgrade.pp new file mode 100644 index 0000000..069601f --- /dev/null +++ b/manifests/cron/dist-upgrade.pp @@ -0,0 +1,21 @@ +class apt::cron::dist-upgrade inherits apt::cron::base { + + $action = "autoclean -y +dist-upgrade -y -o APT::Get::Show-Upgraded=true +" + + file { "/etc/cron-apt/action.d/3-download": + ensure => absent, + } + + config_file { "/etc/cron-apt/action.d/4-dist-upgrade": + content => $action, + require => Package[cron-apt] + } + + config_file { "/etc/cron-apt/config.d/MAILON": + content => "MAILON=upgrade\n", + require => Package[cron-apt] + } + +} diff --git a/manifests/cron/download.pp b/manifests/cron/download.pp new file mode 100644 index 0000000..a27967d --- /dev/null +++ b/manifests/cron/download.pp @@ -0,0 +1,21 @@ +class apt::cron::download inherits apt::cron::base { + + $action = "autoclean -y +dist-upgrade -d -y -o APT::Get::Show-Upgraded=true +" + + file { "/etc/cron-apt/action.d/4-dist-upgrade": + ensure => absent, + } + + config_file { "/etc/cron-apt/action.d/3-download": + content => $action, + require => Package[cron-apt] + } + + config_file { "/etc/cron-apt/config.d/MAILON": + content => "MAILON=changes\n", + require => Package[cron-apt] + } + +} diff --git a/manifests/custom_sources.pp b/manifests/custom_sources.pp index cd7b8fc..31d685a 100644 --- a/manifests/custom_sources.pp +++ b/manifests/custom_sources.pp @@ -2,9 +2,9 @@ define apt::custom_sources_template ($sources_file = "") { file { "/etc/apt/sources.list.d/$sources_file": content => template($name), } - exec { "/usr/bin/apt-get update": + exec { "/usr/bin/apt-get update": subscribe => File["/etc/apt/sources.list.d/$sources_file"], - refreshonly => true, + refreshonly => true, } } diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp index 671abdd..28471b9 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.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/99from_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/99from_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 cf7d523..91955d7 100644 --- a/manifests/default_sources_list.pp +++ b/manifests/default_sources_list.pp @@ -1,10 +1,9 @@ class apt::default_sources_list { - include lsb config_file { # include main, security and backports # additional sources could be included via an array "/etc/apt/sources.list": - content => template( "apt/$operatingsystem/sources.list.erb"), + content => template("apt/${operatingsystem}/sources.list.erb"), require => Package['lsb']; } } diff --git a/manifests/init.pp b/manifests/init.pp index 9c33b4d..8136f25 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,27 +6,76 @@ class apt { import "custom_sources.pp" - + # See README $real_apt_clean = $apt_clean ? { '' => 'auto', default => $apt_clean, } + $use_volatile = $apt_volatile_enabled ? { + '' => false, + default => $apt_volatile_enabled, + } + + $include_src = $apt_include_src ? { + '' => false, + default => $apt_include_src, + } + + $use_next_release = $apt_use_next_release ? { + '' => false, + 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}", + } + $repos = $apt_repos ? { + '' => 'main contrib non-free', + default => "${apt_repos}", + } + package { apt: ensure => installed, require => undef, } + # init $release, $next_release, $codename, $next_codename + case $lsbdistcodename { + '': { + include lsb + $codename = $lsbdistcodename + $release = $lsbdistrelease + } + default: { + $codename = $lsbdistcodename + $release = debian_release($codename) + } + } + $next_codename = debian_nextcodename($codename) + $next_release = debian_nextrelease($release) + case $custom_sources_list { '': { include apt::default_sources_list } default: { - include lsb config_file { "/etc/apt/sources.list": content => $custom_sources_list, - require => Package['lsb']; } } } @@ -38,7 +87,7 @@ class apt { default: { config_file { "/etc/apt/preferences": content => $custom_preferences, - alias => apt_config, + alias => "apt_config", require => File["/etc/apt/sources.list"]; } } @@ -53,64 +102,30 @@ class apt { modules_dir { apt: } # watch apt.conf.d file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; } + file { '/etc/apt/apt.conf.d/99-puppet': + ensure => 'file', + owner => 'root', group => '0', mode => '0644', + } exec { # "&& sleep 1" is workaround for older(?) clients '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"], - Config_file[apt_config] ]; + 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; + alias => "apt_updated"; } ## 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:///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"] ] - } - } - } + # backports uses the normal archive key now + package { "debian-backports-keyring": ensure => absent } if $custom_key_dir { file { "${apt_base_dir}/keys.d": @@ -128,4 +143,4 @@ class apt { # workaround for preseeded_package component file { [ "/var/cache", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory } -} +} diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp index 276c90f..76c432e 100644 --- a/manifests/preseeded_package.pp +++ b/manifests/preseeded_package.pp @@ -1,8 +1,8 @@ define apt::preseeded_package ($content = "", $ensure = "installed") { $seedfile = "/var/cache/local/preseeding/$name.seeds" $real_content = $content ? { - "" => template ( "$debian_version/$name.seeds" ), - Default => $content + "" => template ( "$name.seeds", "$debian_version/$name.seeds" ), + default => $content } file{ $seedfile: diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index 27942b3..805b0ed 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -5,10 +5,10 @@ class apt::unattended_upgrades { } config_file { - "/etc/apt/apt.conf.d/50unattended-upgrades": - source => ["puppet:///modules/site-apt/50unattended-upgrades", - "puppet:///modules/apt/50unattended-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'], } |