From 9bb45cd61b6ad1326e4906356244121d13d409c8 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Sat, 22 Apr 2023 01:24:19 -0700 Subject: [PATCH] conform motd to 80x24 --- files/etc/dynmotd | 34 +++++++++++++++++++++++++++ files/etc/motd | 45 +++++++++++------------------------- init-rocky-system-config.yml | 3 +++ tasks/banners.yml | 9 ++++++++ 4 files changed, 59 insertions(+), 32 deletions(-) create mode 100644 files/etc/dynmotd create mode 100644 tasks/banners.yml diff --git a/files/etc/dynmotd b/files/etc/dynmotd new file mode 100644 index 0000000..92f25c8 --- /dev/null +++ b/files/etc/dynmotd @@ -0,0 +1,34 @@ +#!/bin/bash +RED=$(tput setaf 1) +GREEN=$(tput setaf 2) +YELLOW=$(tput setaf 3) +BLUE=$(tput setaf 4) +MAGENTA=$(tput setaf 5) +CYAN=$(tput setaf 6) +WHITE=$(tput setaf 7) +RESET=$(tput sgr0) +BOLD=$(tput bold) + +uptime=`cat /proc/uptime | cut -f1 -d.` +upDays=$((uptime/60/60/24)) +upHours=$((uptime/60/60%24)) +upMins=$((uptime/60%60)) +upSecs=$((uptime%60)) + +echo -e "${GREEN} + .:^~~~~^:. ${RESET}$(hostname)${GREEN} + .^!?JJJJJJJJJJ?!^. ------------------------------------------------- + ~?JJJJJJJJJJJJJJJJ?~ ${RESET}$(cat /etc/redhat-release)${GREEN} + :?JJJJJJJJJJJJJJJJJJJJ?: ${RESET}Uptime: ${BOLD}$upDays days $upHours hours $upMins minutes $upSecs seconds${GREEN} + .?JJJJJJJJJJJJJJ7?JJJJJJ?. + !JJJJJJJJJJJJJ7: ^?JJJJJ! + 7JJJJJJJJJJJ!: ^7JJJ7 + !JJJJJJJJJ!. :. :7J! + .?JJJJJ?~. :7JJ!. :. + :?JJ?~. ^7JJJJJJ!: + .~~ ^?JJJJJJJJY?: + ^?YYJJJJJJ?!^. + .:^~~~~^:. +${RESET} +" + diff --git a/files/etc/motd b/files/etc/motd index 92f25c8..77d70c2 100644 --- a/files/etc/motd +++ b/files/etc/motd @@ -1,34 +1,15 @@ -#!/bin/bash -RED=$(tput setaf 1) -GREEN=$(tput setaf 2) -YELLOW=$(tput setaf 3) -BLUE=$(tput setaf 4) -MAGENTA=$(tput setaf 5) -CYAN=$(tput setaf 6) -WHITE=$(tput setaf 7) -RESET=$(tput sgr0) -BOLD=$(tput bold) - -uptime=`cat /proc/uptime | cut -f1 -d.` -upDays=$((uptime/60/60/24)) -upHours=$((uptime/60/60%24)) -upMins=$((uptime/60%60)) -upSecs=$((uptime%60)) - -echo -e "${GREEN} - .:^~~~~^:. ${RESET}$(hostname)${GREEN} - .^!?JJJJJJJJJJ?!^. ------------------------------------------------- - ~?JJJJJJJJJJJJJJJJ?~ ${RESET}$(cat /etc/redhat-release)${GREEN} - :?JJJJJJJJJJJJJJJJJJJJ?: ${RESET}Uptime: ${BOLD}$upDays days $upHours hours $upMins minutes $upSecs seconds${GREEN} - .?JJJJJJJJJJJJJJ7?JJJJJJ?. - !JJJJJJJJJJJJJ7: ^?JJJJJ! - 7JJJJJJJJJJJ!: ^7JJJ7 - !JJJJJJJJJ!. :. :7J! - .?JJJJJ?~. :7JJ!. :. - :?JJ?~. ^7JJJJJJ!: - .~~ ^?JJJJJJJJY?: - ^?YYJJJJJJ?!^. + .:^~~~~^:. _____ _ + .^!?JJJJJJJJJJ?!^. | __ \ | | + ~?JJJJJJJJJJJJJJJJ?~ | |__) |___ ___| | ___ _ + :?JJJJJJJJJJJJJJJJJJJJ?: | _ // _ \ / __| |/ / | | | + .?JJJJJJJJJJJJJJ7?JJJJJJ?. | | \ \ (_) | (__| <| |_| | + !JJJJJJJJJJJJJ7: ^?JJJJJ! |_| \_\___/ \___|_|\_\\__, | + 7JJJJJJJJJJJ!: ^7JJJ7 _ _ __/ | + !JJJJJJJJJ!. :. :7J! | | (_) |___/ + .?JJJJJ?~. :7JJ!. :. | | _ _ __ _ ___ __ + :?JJ?~. ^7JJJJJJ!: | | | | '_ \| | | \ \/ / + .~~ ^?JJJJJJJJY?: | |____| | | | | |_| |> < + ^?YYJJJJJJ?!^. |______|_|_| |_|\__,_/_/\_\ .:^~~~~^:. -${RESET} -" +We hope you enjoy your stay. diff --git a/init-rocky-system-config.yml b/init-rocky-system-config.yml index b4e4ff6..e714e65 100644 --- a/init-rocky-system-config.yml +++ b/init-rocky-system-config.yml @@ -47,6 +47,9 @@ - name: Configure common scripts ansible.builtin.import_tasks: tasks/scripts.yml + - name: Configure motd and banners + ansible.builtin.import_tasks: tasks/banners.yml + - name: Configure common skel items ansible.builtin.import_tasks: tasks/skel.yml diff --git a/tasks/banners.yml b/tasks/banners.yml new file mode 100644 index 0000000..fecf294 --- /dev/null +++ b/tasks/banners.yml @@ -0,0 +1,9 @@ +--- +- name: Default motd banner + ansible.builtin.copy: + src: "etc/motd" + dest: "/etc/motd" + owner: root + group: root + mode: '0644' +...