Last active
September 20, 2016 09:33
-
-
Save jrha/90a1630ed3f1bd1fba57fd5c61abfcdb to your computer and use it in GitHub Desktop.
Build motd from node metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_. _. 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