Initial commit of PVC Ansible role
This commit is contained in:
26
roles/base/templates/usr/local/sbin/update-motd.sh.j2
Executable file
26
roles/base/templates/usr/local/sbin/update-motd.sh.j2
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Update dynamic MOTD file
|
||||
# {{ ansible_managed }}
|
||||
|
||||
set -o errexit
|
||||
|
||||
TMPFILE=$(mktemp)
|
||||
TGTFILE=/run/pvc-motd.dynamic
|
||||
DEBVER="({{ ansible_lsb.description }})"
|
||||
|
||||
echo >> $TMPFILE
|
||||
echo "\033[01;34mParallel Virtual Cluster \033[01;36m${DEBVER}\033[0m" >> $TMPFILE
|
||||
echo -n "> \033[01;32m$(hostname)\033[0m" >> $TMPFILE
|
||||
if test -f /etc/hostdesc; then
|
||||
echo " - $( cat /etc/hostdesc )" >> $TMPFILE
|
||||
else
|
||||
echo >> $TMPFILE
|
||||
fi
|
||||
# Get machine information
|
||||
echo "> \033[1;37mPVC node\033[0m on \033[1;31m$(
|
||||
/usr/sbin/dmidecode | grep -A1 'Chassis Information' | tail -1 | awk -F':' '{print $2}' | tr -s ' '
|
||||
)\033[0m hardware" >> $TMPFILE
|
||||
echo "> $(/bin/uname -srvmo)" >> $TMPFILE
|
||||
|
||||
mv $TMPFILE $TGTFILE || rm $TMPFILE
|
Reference in New Issue
Block a user