]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/motd/manifests/init.pp
Make it work with jessie, II
[dsa-puppet.git] / modules / motd / manifests / init.pp
index 0068a5aae9f4393e67c59f54c8f090fceae22070..5f017c912950d404ed3a253911735d98ec347194 100644 (file)
@@ -1,5 +1,44 @@
+# = Class: motd
+#
+# This class configures a sensible motd
+#
+# == Sample Usage:
+#
+#   include motd
+#
 class motd {
-       file { "/etc/motd":
-                content => template("motd.erb") ;
+       if $::lsbmajdistrelease == "testing" or $::lsbmajdistrelease >= 7 {
+               $fname  = '/etc/update-motd.d/puppet-motd'
+               $notify = undef
+               $mode   = '0555'
+
+               file { '/etc/update-motd.d':
+                       ensure => directory,
+                       mode   => '0755'
+               }
+               file { '/etc/motd.tail':
+                       ensure => absent,
+               }
+       } else {
+               $fname  = '/etc/motd.tail'
+               $notify = Exec['updatemotd']
+               $mode   = '0444'
+
+       }
+
+       file { '/etc/motd':
+               ensure => link,
+               target => '/var/run/motd'
+       }
+
+       file { $fname:
+               notify  => $notify,
+               mode    => $mode,
+               content => template('motd/motd.erb')
+       }
+
+       exec { 'updatemotd':
+               command     => 'uname -snrvm > /var/run/motd && cat /etc/motd.tail >> /var/run/motd',
+               refreshonly => true,
        }
 }