From 249b974da2c6f60fb597f5bdec63e9608d576d0a Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Tue, 23 Apr 2024 17:47:17 -0500 Subject: [PATCH] Nuke motd --- playbooks/platforms_fedora-kinoite.yml | 8 --- playbooks/platforms_proxmox-ve-7.yml | 27 ---------- playbooks/platforms_ubuntu-20-04.yml | 13 ----- playbooks/platforms_ubuntu-21-10.yml | 13 ----- playbooks/platforms_ubuntu-22-04.yml | 13 ----- roles/motd/defaults/main.yml | 29 ---------- roles/motd/tasks/main.yml | 11 ---- roles/motd/templates/motd.sh | 75 -------------------------- 8 files changed, 189 deletions(-) delete mode 100755 playbooks/platforms_fedora-kinoite.yml delete mode 100755 playbooks/platforms_proxmox-ve-7.yml delete mode 100755 playbooks/platforms_ubuntu-20-04.yml delete mode 100755 playbooks/platforms_ubuntu-21-10.yml delete mode 100755 playbooks/platforms_ubuntu-22-04.yml delete mode 100644 roles/motd/defaults/main.yml delete mode 100644 roles/motd/tasks/main.yml delete mode 100755 roles/motd/templates/motd.sh diff --git a/playbooks/platforms_fedora-kinoite.yml b/playbooks/platforms_fedora-kinoite.yml deleted file mode 100755 index 455ed22..0000000 --- a/playbooks/platforms_fedora-kinoite.yml +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: ---- -- hosts: platforms_fedora-kinoite - gather_facts: no - tasks: - - name: debug dummy task - debug: msg=ignoreme diff --git a/playbooks/platforms_proxmox-ve-7.yml b/playbooks/platforms_proxmox-ve-7.yml deleted file mode 100755 index 323f1f2..0000000 --- a/playbooks/platforms_proxmox-ve-7.yml +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: ---- -- hosts: platforms_proxmox-ve-7 - gather_facts: no - tasks: - # https://tteck.github.io/Proxmox/ - - name: disable enterprise nag - ansible.builtin.copy: - content: | - DPkg::Post-Invoke { "dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ $? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi"; }; - dest: /etc/apt/apt.conf.d/no-nag-script - owner: root - group: root - mode: "0644" - tags: [ nag, common ] - roles: - - role: backup - vars: - backup_s3backup_list_extra: - - /data - - /etc/kernel - - /etc/modprobe.d - - /etc/modules - - /etc/pve - backup_time: "Mon *-*-* 02:00:00" - tags: [ backup, common ] diff --git a/playbooks/platforms_ubuntu-20-04.yml b/playbooks/platforms_ubuntu-20-04.yml deleted file mode 100755 index dd4e89a..0000000 --- a/playbooks/platforms_ubuntu-20-04.yml +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: ---- -- hosts: platforms_ubuntu-20-04 - gather_facts: no - roles: - - role: motd - vars: - motd_watch_services_extra: - - docker - - kubelet - - postgresql - tags: [ motd, common ] diff --git a/playbooks/platforms_ubuntu-21-10.yml b/playbooks/platforms_ubuntu-21-10.yml deleted file mode 100755 index c5debde..0000000 --- a/playbooks/platforms_ubuntu-21-10.yml +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: ---- -- hosts: platforms_ubuntu-21-10 - gather_facts: no - roles: - - role: motd - vars: - motd_watch_services_extra: - - docker - - kubelet - - postgresql - tags: [ motd, common ] diff --git a/playbooks/platforms_ubuntu-22-04.yml b/playbooks/platforms_ubuntu-22-04.yml deleted file mode 100755 index eb838d7..0000000 --- a/playbooks/platforms_ubuntu-22-04.yml +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: ---- -- hosts: platforms_ubuntu-22-04 - gather_facts: no - roles: - - role: motd - vars: - motd_watch_services_extra: - - docker - - kubelet - - postgresql - tags: [ motd, common ] diff --git a/roles/motd/defaults/main.yml b/roles/motd/defaults/main.yml deleted file mode 100644 index 13a9b5f..0000000 --- a/roles/motd/defaults/main.yml +++ /dev/null @@ -1,29 +0,0 @@ -# vim:ft=ansible: - -# Default motd files to remove from /etc/update-motd.d -motd_remove: - - 00-header - - 10-help-text - - 50-landscape-sysinfo - - 50-motd-news - - 85-fwupd - - 88-esm-announce - - 90-updates-available - - 91-contract-ua-esm-status - - 91-release-upgrade - - 92-unattended-upgrades - - 95-hwe-eol - - 97-overlayroot - - 98-fsck-at-reboot - - 98-reboot-required -motd_remove_extra: [] - -# Services to monitor with our script -# Units that can't be found will be skipped -motd_watch_services: - - backup -motd_watch_services_extra: [] -# Docker images to look for. Matches a simple glob (*{{ item }}*) -# If Docker is not running, this section will be omitted -motd_watch_containers: [] -motd_watch_containers_extra: [] diff --git a/roles/motd/tasks/main.yml b/roles/motd/tasks/main.yml deleted file mode 100644 index 4a650ce..0000000 --- a/roles/motd/tasks/main.yml +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: -- name: remove default motd items - ansible.builtin.file: state=absent path=/etc/update-motd.d/{{ item }} - loop: "{{ motd_remove + motd_remove_extra }}" -- name: disable motd-news - ansible.builtin.systemd: name="{{ item }}" state=stopped enabled=no - with_items: - - motd-news.timer -- name: template out motd script - ansible.builtin.template: src=motd.sh dest=/etc/update-motd.d/50-ansible mode=0755 diff --git a/roles/motd/templates/motd.sh b/roles/motd/templates/motd.sh deleted file mode 100755 index f560b49..0000000 --- a/roles/motd/templates/motd.sh +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/bash - -# motd.sh -# A basic motd script with some nice information. Designed to be extensible -# and easily configurable per-host - -# NOTE: We do not set -e here because we don't want MOTD generation to fail -# in the event that just this script fails - -# Services that we want a quick heads-up on their status -declare -a services -{% for item in (motd_watch_services + motd_watch_services_extra)|sort %} -services+=("{{ item }}") -{% endfor %} - -declare -a containers -{% for item in (motd_watch_containers + motd_watch_containers_extra)|sort %} -containers+=("{{ item }}") -{% endfor %} - -## Now, we actually put this info to use -# Starting with services -if [ -n "${services[*]}" ]; then - printf "\e[1mService Statuses\e[0m\n" - len=20 - for service in "${services[@]}"; do - status="\e[33mUnknown\e[0m" - systemctl status "$service" > /dev/null 2>&1 - case $? in - 0) - status="\e[1;32mRunning\e[0m" - ;; - 1|2) - status="\e[1;31mDead\e[0m" - ;; - 3) - status="\e[37mNot Running\e[0m" - ;; - 4) - continue - ;; - esac - printf " * \e[37m%-${len}.${len}s\e[0m - $status " "$service" - if systemctl is-failed --quiet "$service"; then - printf "\e[1;31m(FAILED!)\e[0m " - fi - printf "\n" - done -fi - -# Containers, if docker is running -if [ -n "${containers[*]}" ] && systemctl -q is-active docker; then - printf "\e[1mContainer Statuses\e[0m\n" - len=20 - for container in "${containers[@]}"; do - status="\e[33mUnknown\e[0m" - image="$(docker ps | tail -n +2 | awk '{print $2}' | grep -ie "$container")" - if [ -n "$image" ]; then - status="\e[1;32mRunning\e[0m - $image" - fi - if [ -z "$image" ]; then - status="\e[1;31mNot Running\e[0m" - fi - printf " * \e[37m%-${len}.${len}s\e[0m - $status " "$container" - printf "\n" - done -fi - -## And some generic system status stuff -printf "\e[1mSystem Status\e[0m\n" -if [ -f /var/run/reboot-required ]; then - printf " * \e[1;33mReboot required\e[0m\n" -else - printf "\e[37m - No outstanding reboots\e[0m\n" -fi