Puppet Class: r_profile::motd

Defined in:
manifests/motd.pp

Overview

R_profile::Motd

Simple MOTD support for POSIX and Windows. To ensure file permissions are explicitly set, I had to use a resource collector against the files that the puppetlabs-motd module creates.

Parameters:

  • template (Any) (defaults to: hiera("r_profile::motd::template", "${module_name}/motd.erb"))

    Process this tempalate and pass the evaluated string to the puppetlabs-motd module

  • content (Any) (defaults to: hiera("r_profile::motd::content", undef))

    Complete message as to insert into /etc/motd

  • issue_content (Any) (defaults to: hiera("r_profile::motd::issue_content", undef))

    Complete message as to insert into /etc/issue

  • issue_net_content (Any) (defaults to: hiera("r_profile::motd::issue_net_content", undef))

    Complete message as to insert into /etc/issue.net



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'manifests/motd.pp', line 12

class r_profile::motd(
    $template           = hiera("r_profile::motd::template", "${module_name}/motd.erb"),
    $content            = hiera("r_profile::motd::content", undef),
    $issue_content      = hiera("r_profile::motd::issue_content", undef),
    $issue_net_content  = hiera("r_profile::motd::issue_net_content", undef),
) {

  # content overrides template
  if $content {
    $_content = $content
  } else {
    $_content = template($template)
  }

  if $kernel == "AIX" {
    if $_content {
      file { "/etc/motd":
        ensure  => file,
        owner   => "bin",
        group   => "bin",
        mode    => "0644",
        content => $_content,
      }
    }
  } else {
    class { "::motd":
      content           => $content,
      issue_content     => $issue_content,
      issue_net_content => $issue_net_content,
    }

    File <| title == '/etc/motd' or title == "/etc/issue" or title == "/etc/issue.net" |> {
      owner => 'root',
      group => 'root',
      mode  => '0644',
    }

  }

}