Skip to content

Instantly share code, notes, and snippets.

@jrha
Last active September 20, 2016 09:33
Show Gist options
  • Save jrha/90a1630ed3f1bd1fba57fd5c61abfcdb to your computer and use it in GitHub Desktop.
Save jrha/90a1630ed3f1bd1fba57fd5c61abfcdb to your computer and use it in GitHub Desktop.
Build motd from node metadata
unique template features/core/motd/config;
include 'components/filecopy/config';
variable MOTD_NODE_INFO ?= "";
variable motd_branch = format('%s (%s)', value('/metadata/template/branch/name'), value('/metadata/template/branch/type'));
variable motd_branch = if (path_exists('/metadata/template/branch/author')) {
format('%s/%s', value('/metadata/template/branch/author'), SELF);
} else {
SELF;
};
variable motd = format(
file_contents('features/core/motd/template.txt'),
value('/hardware/location'),
value('/hardware/rack/room'),
value('/hardware/rack/name'),
motd_branch,
value('/system/archetype/name'),
PERSONALITY,
NODE_OS_VERSION,
SNAPSHOT,
MOTD_NODE_INFO
);
'/software/components/filecopy/services/{/etc/motd}' = dict(
'config', motd,
'owner', 'root:root',
'perms', '0644',
);
_. _. o| _ ._
(_|(_||_|||(_)| |
|
Location: %s %s %s
Branch: %s
Archetype: %s
Personality: %s
Operating System: %s
Snapshot Date: %s
%s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment