]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/manifests/init.pp
motd cleanups
[dsa-puppet.git] / modules / motd / manifests / init.pp
1 # = Class: motd
2 #
3 # This class configures a sensible motd
4 #
5 # == Sample Usage:
6 #
7 #   include motd
8 #
9 class motd {
10         if $::lsbmajdistrelease >= 7 {
11                 $fname  = '/etc/update-motd.d/puppet-motd'
12                 $notify = undef
13                 $mode   = '0555'
14
15                 file { '/etc/update-motd.d':
16                         ensure => directory,
17                         mode   => '0755'
18                 }
19                 file { '/etc/motd.tail':
20                         ensure => absent,
21                 }
22         } else {
23                 $fname  = '/etc/motd.tail'
24                 $notify = Exec['updatemotd']
25                 $mode   = '0444'
26
27         }
28
29         file { '/etc/motd':
30                 ensure => link,
31                 target => '/var/run/motd'
32         }
33
34         file { $fname:
35                 notify  => $notify,
36                 mode    => $mode,
37                 content => template('motd/motd.erb')
38         }
39
40         exec { 'updatemotd':
41                 command     => 'uname -snrvm > /var/run/motd && cat /etc/motd.tail >> /var/run/motd',
42                 refreshonly => true,
43         }
44 }