From 50cee84a047983a7e5762ca41402bf2d0de59295 Mon Sep 17 00:00:00 2001 From: Ronggo Radityo Date: Mon, 23 Mar 2020 11:13:00 +0700 Subject: [PATCH] - Sesuaikan dengan debian 10 - tambahi pemberitahuan reboot dari unattended upgrade --- meta/main.yml | 1 + tasks/main.yml | 20 +++++++++++++------- templates/etc/update-motd.d/30-sysinfo.j2 | 2 +- templates/etc/update-motd.d/80-reboot.j2 | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 templates/etc/update-motd.d/80-reboot.j2 diff --git a/meta/main.yml b/meta/main.yml index 5cfa9bb..a0a396b 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -19,6 +19,7 @@ galaxy_info: versions: - 8 - 9 + - 10 galaxy_tags: - linux diff --git a/tasks/main.yml b/tasks/main.yml index 3fb8609..8082b27 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,25 +1,31 @@ --- # tasks file for roles/motd -- name: MOTD - set motd - template: - src: templates/etc/motd.j2 - dest: /etc/motd +- name: MOTD - set motd + template: + src: templates/etc/motd.j2 + dest: /etc/motd mode: 0644 - name: MOTD - set motd banner - template: + template: src: templates/etc/update-motd.d/20-banner.j2 dest: /etc/update-motd.d/20-banner mode: 0755 - name: MOTD - set system info - template: + template: src: templates/etc/update-motd.d/30-sysinfo.j2 dest: /etc/update-motd.d/30-sysinfo mode: 0755 - name: MOTD - set free disk space - template: + template: src: templates/etc/update-motd.d/40-disks.j2 dest: /etc/update-motd.d/40-disks mode: 0755 + +- name: MOTD - Reboot Warning + template: + src: templates/etc/update-motd.d/80-reboot.j2 + dest: /etc/update-motd.d/80-reboot + mode: 0755 diff --git a/templates/etc/update-motd.d/30-sysinfo.j2 b/templates/etc/update-motd.d/30-sysinfo.j2 index bd4b7e7..a255a34 100644 --- a/templates/etc/update-motd.d/30-sysinfo.j2 +++ b/templates/etc/update-motd.d/30-sysinfo.j2 @@ -52,4 +52,4 @@ $W CPU.........: $W$PROCESSOR_NAME ($G$PROCESSOR_COUNT$W vCPU) $W Memory......: $G$USED$W used, $G$FREE$W free, $G$TOTAL$W total $W IP Addresses: $NET_IPS -$W DNS_SERVER..: $G$DNS_SERVER$W" +$W DNS Server..: $G$DNS_SERVER$W" diff --git a/templates/etc/update-motd.d/80-reboot.j2 b/templates/etc/update-motd.d/80-reboot.j2 new file mode 100644 index 0000000..56a6ad3 --- /dev/null +++ b/templates/etc/update-motd.d/80-reboot.j2 @@ -0,0 +1,18 @@ +#!/bin/bash + +white="\e[39m" +green="\e[1;32m" +red="\e[1;31m" +dim="\e[2m" +undim="\e[0m" + + +if [ -f /var/run/reboot-required ]; then + echo + echo -e "${red}<<================= REBOOT REQUIRED =====================>" + echo + echo -e "${white}Packages causing reboot:${dim}" + cat -n /var/run/reboot-required.pkgs + echo -e "${red}<<=======================================================>${undim}" +fi +