Nuke motd
This commit is contained in:
parent
b780551d1d
commit
249b974da2
@ -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
|
@ -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 ]
|
@ -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 ]
|
@ -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 ]
|
@ -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 ]
|
@ -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: []
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue
Block a user