UAlaska-IT / motd_chef_status

Configures MOTD to display system and Chef information
MIT License
2 stars 1 forks source link

MOTD Chef Status Cookbook

License GitHub Tag Build status

Maintainer: OIT Systems Engineering (ua-oit-se@alaska.edu)

Purpose

This cookbook configures Message of the Day (MOTD) to display system information and Chef status.

It also clears some verbose, distro-standard MOTD fragments.

MOTD is dynamic on every supported distro. When it is available and works properly on the platform, /etc/update-motd.d/ is used. Otherwise /etc/profile.d/ is used as a fallback.

The MOTD message is reasonably standard across platforms. This cookbook does not configure SSH, so any login message will remain. Effort has been made to remove fragments from standard distributions and cloud-provider fragments, but is it infeasible to remove every possible fragment while respecting attributes that govern their removal.

By default, MOTD on various platforms will appear similar to below.

Ubuntu

Ubuntu Screenshot

CentOS

CentOS Screenshot

Run status will turn red if the last Chef converge failed. Timing will turn red if the last run occurred longer ago than the maximum duration allowed by the Chef client.

Requirements

Chef

This cookbook requires Chef 14+

Platforms

Supported Platform Families:

Platforms validated via Test Kitchen:

Notes:

Dependencies

This cookbook does not constrain its dependencies because it is intended as a utility library. It should ultimately be used within a wrapper cookbook.

Resources

This cookbook provides one resources for configuring and installing a MOTD fragment. The fragment will be placed in the appropriate directory and given the appropriate extension for the platform.

motd_fragment

A motd_fragment manages a single script fragment (file).

Actions

Two action are provided.

Attributes

This resource has four attributes.

Recipes

motd_chef_status::default

This recipe installs and configures dynamic MOTD by calling all of the other recipes.

Attributes

None

motd_chef_status::install

This recipe installs update-motd on platforms that support it.

Attributes

None

motd_chef_status::remove_fragments

This recipe removes possibly all pre-existing MOTD fragments to keep the login uncluttered and the Chef warning prominent.

Attributes

Three attributes determine the fragments that are deleted. Each fragment list has no effect if the corresponding fragment type is not removed.

motd_chef_status::add_fragments

This recipe installs possibly two fragments, one a banner and the other a Chef warning and status.

Attributes

Examples

The motd_fragment resource can be used as below.

motd_fragment 'motd-header' do
  fragment_name '00-header'
  template_cookbook 'my_cookbook'
  template_source 'motd-header.sh.erb'
  template_variables {}
end

Development

See CONTRIBUTING.md and TESTING.md.