Defined Type: system::role

Defined in:
modules/system/manifests/role.pp

Overview

Define: system::role

Adds a banner message to the server MOTD (usually displayed on login) that identifies the role of the server.

Parameters

ensure

Present or absent. (Default: present.)

description

A human-readable description of the role. Optional.

Example

system::role { 'analytics::hadoop::master':
  description => 'Hadoop Master (NameNode & ResourceManager)'
}

Parameters:

  • ensure (Any) (defaults to: present)
  • description (Any) (defaults to: undef)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'modules/system/manifests/role.pp', line 20

define system::role(
    $ensure      = present,
    $description = undef,
) {
    $message = $description ? {
        undef   => "${::hostname} is ${title}",
        default => "${::hostname} is a ${description} (${title})",
    }

    $role_title = regsubst($title, '^role::', '')

    motd::script { "role-${role_title}":
        ensure   => $ensure,
        priority => 5,
        content  => "#!/bin/sh\necho '${message}'\n",
    }
}