Report abuse

set up /etc/motd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class motd {
        common::concat_file{"/etc/motd":
                owner           => root,
                group           => root,
                mode            => 644,
        }

        Common::Concat_snippet{
                owner           => root,
                group           => root,
                directory       => "/etc/motd.d",
        }

        common::concat_snippet{"motd_header":
                order           => 00,
                directory       => "/etc/motd.d",
                source          => ["puppet://puppet/modules/motd/motd.$fqdn",
                                    "puppet://puppet/modules/motd/motd.$domain",
                                    "puppet://puppet/modules/motd/motd.$environment"]
        }

        common::concat_snippet{"motd_modules_header":
                order           => 01,
                content         => "\tPuppet Modules:\n",
        }

        common::concat_snippet{"motd_modules_footer":
                order           => 99,
                content         => " \n\n",
        }
}

ability to register into /etc/motd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
define motd::register($content = "", $order = 10) {
        case $content {
                "":             { $msg = $name }
                default:        { $msg = $content }
        }

        common::concat_snippet{"motd_${name}":
                owner           => root,
                group           => root,
                directory       => "/etc/motd.d",
                content         => "\t\t- ${msg}\n",
                order           => $order,
        }
}

some module adding itself to /etc/motd

1
2
3
class stomphost {
        motd::register{"stomp host": }
}

sample output

1
2
3
4
5
6
7
8
9
   Welcome to xxxxx 
            hosted at Hetzner, Germany

        Puppet Modules:
                - apache
                - iptables
                - stomp host
                - xen dom0 skeleton