]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
New class: apt::reboot_required_notify
authorintrigeri <intrigeri@boum.org>
Sat, 11 Dec 2010 13:43:24 +0000 (14:43 +0100)
committerintrigeri <intrigeri@boum.org>
Sat, 11 Dec 2010 13:50:16 +0000 (14:50 +0100)
This class installs a daily cronjob that checks if a package upgrade
requires the system to be rebooted; if so, cron sends a notification
email to root.

README
manifests/reboot_required_notify.pp [new file with mode: 0644]

diff --git a/README b/README
index 8e1dcbab96e62c3a7f8566a47be26e98b848e704..a84b510910febb009258b529f1d731d82d765da2 100644 (file)
--- a/README
+++ b/README
@@ -218,6 +218,13 @@ apt::proxy_client
 This class adds the right configuration to apt to make it fetch packages via a
 proxy. The variables $apt_proxy and $apt_proxy_port need to be set (see above).
 
+apt::reboot_required_notify
+---------------------------
+
+This class installs a daily cronjob that checks if a package upgrade
+requires the system to be rebooted; if so, cron sends a notification
+email to root.
+
 apt::unattended_upgrades
 ------------------------
 
diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp
new file mode 100644 (file)
index 0000000..3c6db79
--- /dev/null
@@ -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'],
+  }
+
+}