summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/reboot_required_notify.pp25
-rw-r--r--manifests/reboot_required_notify/jessie.pp13
-rw-r--r--manifests/reboot_required_notify/wheezy.pp23
3 files changed, 47 insertions, 14 deletions
diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp
index 722e8a5..82466d2 100644
--- a/manifests/reboot_required_notify.pp
+++ b/manifests/reboot_required_notify.pp
@@ -1,21 +1,18 @@
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,
+ $jessie_or_newer = $::operatingsystemmajrelease ? {
+ 5 => false,
+ 6 => false,
+ 7 => false,
+ default => true,
}
- # cron-apt defaults to run every night at 4 o'clock
- # plus some random time <1h.
- # 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 => 5,
- minute => 20,
- require => Package['update-notifier-common'],
+ if $jessie_or_newer {
+ class { 'apt::reboot_required_notify::jessie': }
+ # Clean up systems that were upgraded from Wheezy or earlier:
+ class { 'apt::reboot_required_notify::wheezy': ensure => absent }
+ } else {
+ class { 'apt::reboot_required_notify::wheezy': }
}
}
diff --git a/manifests/reboot_required_notify/jessie.pp b/manifests/reboot_required_notify/jessie.pp
new file mode 100644
index 0000000..51b75a2
--- /dev/null
+++ b/manifests/reboot_required_notify/jessie.pp
@@ -0,0 +1,13 @@
+class apt::reboot_required_notify::jessie ($ensure = present) {
+
+ # On Jessie and newer, 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.
+ # This package also sends a daily email to the administrator when a system
+ # reboot is required, e.g. due to a kernel update.
+ package { 'reboot-notifier':
+ ensure => $ensure,
+ }
+
+}
diff --git a/manifests/reboot_required_notify/wheezy.pp b/manifests/reboot_required_notify/wheezy.pp
new file mode 100644
index 0000000..06998ef
--- /dev/null
+++ b/manifests/reboot_required_notify/wheezy.pp
@@ -0,0 +1,23 @@
+class apt::reboot_required_notify::wheezy ($ensure = present) {
+
+ # On Wheezy and older, 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 => $ensure,
+ }
+
+ # cron-apt defaults to run every night at 4 o'clock
+ # plus some random time <1h.
+ # so we check if a reboot is required a bit later.
+ cron { 'apt_reboot_required_notify':
+ ensure => $ensure,
+ command => 'if [ -f /var/run/reboot-required ]; then echo "Reboot required\n" ; cat /var/run/reboot-required.pkgs ; fi',
+ user => root,
+ hour => 5,
+ minute => 20,
+ require => Package['update-notifier-common'],
+ }
+
+}