/var/run/motd no longer exists on stretch, link /etc/motd to /run/motd.dynamic instead
[mirror/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         file { '/etc/update-motd.d':
11                 ensure => directory,
12                 mode   => '0755'
13         }
14         file { '/etc/motd.tail':
15                 ensure => absent,
16         }
17
18         if versioncmp($::lsbmajdistrelease, '9') < 0 {
19                 file { '/etc/motd':
20                         ensure => link,
21                         target => '/var/run/motd'
22                 }
23         } else {
24                 file { '/etc/motd':
25                         ensure => link,
26                         target => '/run/motd.dynamic'
27                 }
28         }
29
30         file { '/etc/update-motd.d/puppet-motd':
31                 notify  => undef,
32                 mode    => '0555',
33                 content => template('motd/motd.erb')
34         }
35
36         exec { 'updatemotd':
37                 command     => 'uname -snrvm > /var/run/motd && cat /etc/motd.tail >> /var/run/motd',
38                 refreshonly => true,
39         }
40 }