Defined Type: motd::script

Defined in:
manifests/script.pp

Summary

A short summary of the purpose of this defined type.

Overview

A description of what this defined type does

Examples:

motd::script { 'namevar': }

Parameters:

  • priority (Integer[0, 99]) (defaults to: 50)

    where in the motd list whill the message display. higher values wil be at the bottom

  • content (Optional[String]) (defaults to: undef)

    the raw content of the message

  • source (Optional[Stdlib::Filesource]) (defaults to: undef)

    a source location for the message



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'manifests/script.pp', line 10

define motd::script (
  Integer[0, 99]               $priority  = 50,
  Optional[String]             $content = undef,
  Optional[Stdlib::Filesource] $source  = undef,
) {
  include motd

  if $source == undef and $content == undef {
    fail('you must provide either "source" or "content"')
  }
  if $source != undef and $content != undef {
    fail('"source" and "content" are mutually exclusive')
  }

  $safe_name = regsubst($title, '[\W_]', '-', 'G').downcase
  $script    = sprintf('%02d-%s', $priority, $safe_name)

  file { "/etc/update-motd.d/${script}":
    ensure  => file,
    content => $content,
    source  => $source,
    mode    => '0555',
  }
}