diff --git a/ansible-5/roles/common/files/motd/reboot_required.sh b/ansible-5/roles/common/files/motd/reboot_required.sh new file mode 100644 index 0000000..be8b476 --- /dev/null +++ b/ansible-5/roles/common/files/motd/reboot_required.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -x /usr/lib/update-notifier/update-motd-reboot-required ]; then + exec /usr/lib/update-notifier/update-motd-reboot-required +fi diff --git a/ansible-5/roles/common/files/motd/systats.sh b/ansible-5/roles/common/files/motd/systats.sh index 09212d4..ec2b6ff 100644 --- a/ansible-5/roles/common/files/motd/systats.sh +++ b/ansible-5/roles/common/files/motd/systats.sh @@ -143,6 +143,7 @@ swap_usage=`free -m | awk '/Swap:/ { printf("%3.1f%%", $3/$2*100) }'` #getboardtemp # DISPLAY +echo echo "System information as of: $date" echo display "System load" "${load%% *}" "${critical_load}" "0" "" "${load#* }" diff --git a/ansible-5/roles/common/files/motd/updates_available.sh b/ansible-5/roles/common/files/motd/updates_available.sh new file mode 100644 index 0000000..9377fdc --- /dev/null +++ b/ansible-5/roles/common/files/motd/updates_available.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +stamp="/var/lib/update-notifier/updates-available" + +[ ! -r "$stamp" ] || cat "$stamp" + +find $stamp -newermt 'now-7 days' 2> /dev/null | grep -q -m 1 '.' || /usr/share/update-notifier/notify-updates-outdated diff --git a/ansible-5/roles/common/tasks/main.yml b/ansible-5/roles/common/tasks/main.yml index 70c2aed..8adea42 100644 --- a/ansible-5/roles/common/tasks/main.yml +++ b/ansible-5/roles/common/tasks/main.yml @@ -8,8 +8,8 @@ # update packages to latest - include_tasks: apply_updates.yml -#- name: update login screen -# include_tasks: motd.yml +- name: update login screen + include_tasks: motd.yml - name: update fstab include_tasks: update_fstab.yml diff --git a/ansible-5/roles/common/tasks/motd.yml b/ansible-5/roles/common/tasks/motd.yml index 5929a15..d446e80 100644 --- a/ansible-5/roles/common/tasks/motd.yml +++ b/ansible-5/roles/common/tasks/motd.yml @@ -12,10 +12,16 @@ with_items: - lsb-release - figlet - - update-motd +# - update-motd - lm-sensors - when: ansible_architecture != 'armv7l' +- name: Create /etc/update-motd.d/ if it does not exist + ansible.builtin.file: + path: /etc/update-motd.d/ + state: directory + owner: root + group: root + mode: '0755' - name: remove help text file: @@ -24,7 +30,6 @@ with_items: - /etc/update-motd.d/10-help-text - /etc/update-motd.d/51-cloudguest - when: ansible_architecture != 'armv7l' - name: add new info @@ -35,4 +40,3 @@ with_items: - { src: motd/hostname.sh, dest: 10-hostname } - { src: motd/systats.sh, dest: 11-sysstats} - when: ansible_architecture != 'armv7l'