diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/cron/base.pp | 16 | ||||
-rw-r--r-- | manifests/init.pp | 3 | ||||
-rw-r--r-- | manifests/reboot_required_notify.pp | 20 |
3 files changed, 38 insertions, 1 deletions
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index de55772..7ccfce6 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -1,4 +1,20 @@ class apt::cron::base { package { cron-apt: ensure => installed } + + case $apt_cron_hours { + '': {} + default: { + # cron-apt defaults to run every night at 4 o'clock + # so we try not to run at the same time. + cron { 'apt_cron_every_N_hours': + command => 'test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt', + user => root, + hour => "${apt_cron_hours}", + minute => 10, + require => Package['cron-apt'], + } + } + } + } diff --git a/manifests/init.pp b/manifests/init.pp index 2d46ad4..7fa811d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -62,7 +62,7 @@ class apt { include lsb - # init $release, $next_release, $codename, $next_codename + # init $release, $next_release, $codename, $next_codename, $release_version case $lsbdistcodename { '': { $codename = $lsbdistcodename @@ -73,6 +73,7 @@ class apt { $release = debian_release($codename) } } + $release_version = debian_release_version($codename) $next_codename = debian_nextcodename($codename) $next_release = debian_nextrelease($release) diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp new file mode 100644 index 0000000..3c6db79 --- /dev/null +++ b/manifests/reboot_required_notify.pp @@ -0,0 +1,20 @@ +class apt::reboot_required_notify { + + # This package installs the script that created /var/run/reboot-required*. + # This script (/usr/share/update-notifier/notify-reboot-required) is + # triggered e.g. by kernel packages. + package { update-notifier-common: + ensure => installed, + } + + # cron-apt defaults to run every night at 4 o'clock + # so we check if a reboot is required a bit later. + cron { 'apt_reboot_required_notify': + command => 'if [ -f /var/run/reboot-required ]; then echo "Reboot required\n" ; cat /var/run/reboot-required.pkgs ; fi', + user => root, + hour => 4, + minute => 20, + require => Package['update-notifier-common'], + } + +} |