Compare commits

..

3 Commits

7 changed files with 87 additions and 17 deletions

View File

@ -9,6 +9,9 @@ timezone_location: Canada/Eastern
# Cluster domain for node FQDNs
local_domain: upstream.local
# Email address of the manager of the cluster
manager_email: team@company.tld
# DNS recursive servers and search domains for nodes
recursive_dns_servers:
- 8.8.8.8

View File

@ -468,12 +468,6 @@
- name: set PVC Plymouth theme as the default
command: plymouth-set-default-theme -R pvc
# issue prompt
- name: install PVC /etc/issue file
template:
src: etc/issue.j2
dest: /etc/issue
# syslog
- name: install rsyslog and logrotate configs
template:
@ -638,24 +632,26 @@
tags: base-shell
# motd
- name: ensure update-motd and profile.d scripts are present
- name: ensure update-issue, update-motd and profile.d scripts are present
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
with_items:
- { src: "usr/local/sbin/update-issue.sh.j2", dest: "/usr/local/sbin/update-issue.sh" }
- { src: "usr/local/sbin/update-motd.sh.j2", dest: "/usr/local/sbin/update-motd.sh" }
- { src: "etc/profile.d/w.sh.j2", dest: "/etc/profile.d/w.sh" }
- { src: "etc/profile.d/pvc.sh.j2", dest: "/etc/profile.d/zzz_pvc.sh" }
register: profile_scripts
tags: base-shell
- name: install update-motd crontab
- name: install banner update crontabs
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0644
with_items:
- { src: "etc/cron.d/update-issue.j2", dest: "/etc/cron.d/update-issue" }
- { src: "etc/cron.d/update-motd.j2", dest: "/etc/cron.d/update-motd" }
tags: base-shell
@ -670,6 +666,11 @@
when: profile_scripts.changed
tags: base-shell
- name: run update-issue on change
command: /usr/local/sbin/update-issue.sh
when: profile_scripts.changed
tags: base-shell
# htop
- name: install htop configuration
template:

View File

@ -0,0 +1,5 @@
# cron file for update-issue
# {{ ansible_managed }}
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
@reboot root /usr/local/sbin/update-issue.sh &>/dev/null

View File

@ -1,4 +1,4 @@
# cron file for motd
# cron file for update-motd
# {{ ansible_managed }}
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

View File

@ -1,4 +0,0 @@
Parallel Virtual Cluster node \n \l
Base system: Debian GNU/Linux {{ debian_version }} "{{ debian_codename }}"

View File

@ -0,0 +1,61 @@
#!/bin/bash
# Update dynamic ISSUE file
# {{ ansible_managed }}
set -o errexit
# Title-case generator
tc() { set ${*,,} ; echo ${*^} ; }
TMPFILE=$(mktemp)
TGTFILE=/etc/issue
VERSION_ID="$( cat /etc/debian_version )"
VERSION_CODENAME="$( grep '^VERSION_CODENAME=' /etc/os-release | awk -F'=' '{ print $2 }' )"
DEBVER="${NAME} ${VERSION_ID} \"$(tc ${VERSION_CODENAME} )\""
PVCVER="$( /usr/share/pvc/pvcnoded.py --version )"
echo "\033[0m" >> $TMPFILE
echo >> $TMPFILE
echo " ███████████████████████ █████ █████ ███████████ ██ ██ ██ " >> $TMPFILE
echo " ███████████████████████ █████ █████ ███████████ ██ ██ ██ " >> $TMPFILE
echo " ████ █████ █████ ████ " >> $TMPFILE
echo " ████ █████ █████ ████ " >> $TMPFILE
echo " ███████████████████████ █████ █████ ████ " >> $TMPFILE
echo " ███████████████████████ █████ █████ ████ " >> $TMPFILE
echo " ███ █████████ ███████████████████████ " >> $TMPFILE
echo " ███ ███████ ███████████████████████ " >> $TMPFILE
echo >> $TMPFILE
echo >> $TMPFILE
echo -e " \033[01;34mParallel Virtual Cluster (PVC) Node\033[0m" >> $TMPFILE
echo >> $TMPFILE
echo -e " > \033[1;34mNode name:\033[0m \033[01;36m$(hostname)\033[0m" >> $TMPFILE
echo -e " > \033[1;34mCluster name:\033[0m \033[01;36m{{ cluster_group }}\033[0m" >> $TMPFILE
echo -e " > \033[1;34mSystem type:\033[0m PVC \033[1;36m{% if is_coordinator %}coordinator{% else %}hypervisor{% endif %}\033[0m node" >> $TMPFILE
echo -e " > \033[1;34mManaged by:\033[0m {{ manager_email }}" >> $TMPFILE
# Get machine information
HARDWARE_DETAIL="$( /usr/sbin/dmidecode | grep -A7 'System Information' )"
HARDWARE_VENDOR="$( grep 'Manufacturer:' <<<"${HARDWARE_DETAIL}" | sed 's/Manufacturer: //; s/\s*$//g; s/^\s*//g' )"
if [[ -z ${HARDWARE_VENDOR} ]]; then
HARDWARE_VENDOR="Unknown"
fi
HARDWARE_MODEL="$( grep 'Product Name:' <<<"${HARDWARE_DETAIL}" | sed 's/Product Name: //; s/\s*$//g; s/^\s*//g' )"
if [[ -z ${HARDWARE_MODEL} ]]; then
HARDWARE_MODEL="Unknown"
fi
HARDWARE_SERIAL="$( grep 'Serial Number:' <<<"${HARDWARE_DETAIL}" | sed 's/Serial Number: //; s/\s*$//g; s/^\s*//g' )"
if [[ -z ${HARDWARE_SERIAL} ]]; then
HARDWARE_SERIAL="Unknown"
fi
echo -e -n " > \033[1;34mHardware Vendor:\033[0m ${HARDWARE_VENDOR}" >> $TMPFILE
echo -e -n " \033[1;34mModel:\033[0m ${HARDWARE_MODEL}" >> $TMPFILE
echo -e -n " \033[1;34mSerial:\033[0m ${HARDWARE_SERIAL}" >> $TMPFILE
echo >> $TMPFILE
echo >> $TMPFILE
echo " UNAUTHORIZED ACCESS IS PROHIBITED. ALL LOGIN ATTEMPTS WILL BE LOGGED." >> $TMPFILE
echo >> $TMPFILE
mv $TMPFILE $TGTFILE || rm $TMPFILE
chmod 644 $TGTFILE

View File

@ -15,11 +15,16 @@ NAME="$( grep '^NAME=' /etc/os-release | awk -F'"' '{ print $2 }' )"
VERSION_ID="$( cat /etc/debian_version )"
VERSION_CODENAME="$( grep '^VERSION_CODENAME=' /etc/os-release | awk -F'=' '{ print $2 }' )"
DEBVER="${NAME} ${VERSION_ID} \"$(tc ${VERSION_CODENAME} )\""
PVCVER="$( /usr/share/pvc/pvcnoded.py --version )"
echo >> $TMPFILE
echo -e "\033[01;34mParallel Virtual Cluster \033[01;36m(${DEBVER})\033[0m" >> $TMPFILE
echo -e "> \033[1;34mHostname:\033[0m \033[01;36m$(hostname)\033[0m" >> $TMPFILE
echo -e "> \033[1;34mSystem Type:\033[0m: PVC \033[1;36m{% if is_coordinator %}coordinator{% else %}hypervisor{% endif %}\033[0m node" >> $TMPFILE
echo -e "\033[01;34mParallel Virtual Cluster (PVC) Node\033[0m" >> $TMPFILE
echo -e "> \033[1;34mNode name:\033[0m \033[01;36m$(hostname)\033[0m" >> $TMPFILE
echo -e "> \033[1;34mCluster name:\033[0m \033[01;36m{{ cluster_group }}\033[0m" >> $TMPFILE
echo -e "> \033[1;34mSystem type:\033[0m PVC \033[1;36m{% if is_coordinator %}coordinator{% else %}hypervisor{% endif %}\033[0m node" >> $TMPFILE
echo -e "> \033[1;34mPVC version:\033[0m ${PVCVER}" >> $TMPFILE
echo -e "> \033[1;34mBase system:\033[0m {{ ansible_lsb.description }}" >> $TMPFILE
echo -e "> \033[1;34mKernel:\033[0m $(/bin/uname -vm)" >> $TMPFILE
# Get machine information
HARDWARE_DETAIL="$( /usr/sbin/dmidecode | grep -A7 'System Information' )"
@ -39,7 +44,6 @@ echo -e -n "> \033[1;34mHardware Vendor:\033[0m ${HARDWARE_VENDOR}" >> $TMPFILE
echo -e -n " \033[1;34mModel:\033[0m ${HARDWARE_MODEL}" >> $TMPFILE
echo -e -n " \033[1;34mSerial:\033[0m ${HARDWARE_SERIAL}" >> $TMPFILE
echo >> $TMPFILE
echo -e "> \033[1;34mKernel:\033[0m $(/bin/uname -srvmo)" >> $TMPFILE
mv $TMPFILE $TGTFILE || rm $TMPFILE
chmod 644 $TGTFILE