Skip to content

Latest commit

 

History

History
182 lines (116 loc) · 4.42 KB

File metadata and controls

182 lines (116 loc) · 4.42 KB

Reference

Table of Contents

Classes

Public Classes

  • meta_motd: Update /etc/motd with information about the host

Private Classes

  • meta_motd::keyvalue::blank: Adds blank link after the meta_motd::keyvalue entries
  • meta_motd::register::blank: Adds blank link after the meta_motd::register entries

Defined types

Public Defined types

Private Defined types

  • meta_motd::register: Deprecated: add an old-style entry to the MOTD.

Classes

meta_motd

Update /etc/motd with information about the host.

  • If the system is a Puppet Enterprise server an entry will automatically be added to the MOTD showing what version of PE is installed.
  • Similarly, an entry will be added showing what the certname used by the system is if the FQDN and the certname do not match.

Note: It is sometimes useful to disable changes to /etc/motd when comparing runs in different environments. You can do that like so: sudo FACTER_suppress_motd=true puppet agent --test ...

Examples

Set MOTD template based on a conditional expression
class profile::motd {
  case $profile::server::someparam {
    /infranext/: { $motd_template = 'meta_motd/colossal-puppet-dag.epp' }
    default:     { $motd_template = 'meta_motd/short-puppet.epp' }
  }

  class { 'meta_motd':
    epp_template => $motd_template,
    epp_params   => {
      roles    => lookup('classes', Array[String], 'unique', []),
      location => $facts['whereami'],
    },
  }
}
Use a template stored in your profile module
class { 'meta_motd':
  epp_template => 'profile/motd.epp',
}

Parameters

The following parameters are available in the meta_motd class:

epp_template

Data type: String[1]

This is the path to an EPP template passed into content parameter of a concat::fragment resource. All templates in this module are avaialable by setting this to meta_motd/<name of template file>. This can also be set to use an EPP templates from another module by replacing the meta_motd part of the path.

Default value: 'meta_motd/short-puppet.epp'

epp_params

Data type: Hash

This represents the parameters that will be passed to the template referenced in $epp_template. If you have defined a template that does not need parameters you can set this to {}.

Default value: { roles => lookup('classes', Array[String], 'unique', []), location => undef, }

Defined types

meta_motd::fragment

Add a fragment to the MOTD, if allowed

Examples

meta_motd::fragment { 'EoL Notice':
  content => @(END),
    NOTICE: this system is scheduled for decommissioning within the next two weeks
    Contact IT if this poses a problem for you or your team.
    | END
}

Parameters

The following parameters are available in the meta_motd::fragment defined type:

content

Data type: String[1]

the content to add to the MOTD

Default value: $title

order

Data type: String[2]

the order option to be passed to the concat::fragment

Default value: '50'

meta_motd::keyvalue

Add a line to the "key: value" section of the MOTD. All such values go between the header and entries added via meta_motd::register. Services added by the profile_metadata module will also be below these entries.

Examples

meta_motd::keyvalue { "PE build: ${facts['pe_build']}": }
meta_motd::keyvalue { "Jenkins alias: ${url}": }

Parameters

The following parameters are available in the meta_motd::keyvalue defined type:

content

Data type: String[5]

A string in "key: value" format. The key must start with a word character (regex \w). It can then have zero or more spaces, word characters, or dashes. Next it must contain another word character followed by a colon and a space.

Default value: $title