]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/manifests/init.pp
b200312722781191961dee53acee6b9e50ef7cc7
[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
11         if $::lsbdistcodename == 'wheezy' {
12                 $fname  = '/etc/update-motd.d/puppet-motd'
13                 $notify = undef
14                 $mode   = '0555'
15
16                 file { '/etc/update-motd.d':
17                         ensure => directory,
18                         mode   => '0755'
19                 }
20
21         } elsif $::lsbdistcodename == 'squeeze' {
22                 $fname  = '/etc/motd.tail'
23                 $notify = Exec['updatemotd']
24                 $mode   = '0444'
25
26         }
27
28         file { '/etc/motd':
29                 ensure => link,
30                 target => '/var/run/motd'
31         }
32
33         file { $fname:
34                 notify  => $notify,
35                 mode    => $mode,
36                 content => template('motd/motd.erb')
37         }
38
39         exec { 'updatemotd':
40                 command     => 'uname -snrvm > /var/run/motd && cat /etc/motd.tail >> /var/run/motd',
41                 refreshonly => true,
42         }
43 }