]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/motd/manifests/init.pp
motd cleanups
[dsa-puppet.git] / modules / motd / manifests / init.pp
index 9fedde753d21a0744284c15b70eced1eb07e0163..8936206439d406bb16f77436477f963d5c2eee11 100644 (file)
@@ -1,10 +1,44 @@
+# = Class: motd
+#
+# This class configures a sensible motd
+#
+# == Sample Usage:
+#
+#   include motd
+#
 class motd {
-       file { "/etc/motd.tail":
-                notify  => Exec["updatemotd"],
-                content => template("motd.erb") ;
-       }
-        exec { "updatemotd":
-                command => "uname -snrvm > /var/run/motd && cat /etc/motd.tail >> /var/run/motd",
-                refreshonly => true
-        }
+       if $::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,
+       }
 }