Add basic motd to all machines
This commit is contained in:
parent
2a43b55cdd
commit
acc12fbaa0
@ -33,6 +33,7 @@
|
||||
copy:
|
||||
src: "motd-news"
|
||||
dest: "/etc/default/motd-news"
|
||||
tags: [ motd ]
|
||||
- name: Disable default update-motd tasks
|
||||
file:
|
||||
path: "/etc/update-motd.d/{{ item }}"
|
||||
@ -49,7 +50,14 @@
|
||||
- "92-unattended-upgrades"
|
||||
- "95-hwe-eol"
|
||||
- "97-overlayroot"
|
||||
tags: [ motd ]
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
- name: Add update-motd tasks
|
||||
template:
|
||||
src: 50-ansible-motd.sh
|
||||
dest: /etc/update-motd.d/50-ansible
|
||||
mode: "0755"
|
||||
tags: [ motd ]
|
||||
- name: Configure Ansible user
|
||||
include_tasks: ansibleuser.yml
|
||||
become: yes
|
||||
|
34
roles/common/templates/50-ansible-motd.sh
Executable file
34
roles/common/templates/50-ansible-motd.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# 50-ansible-motd.sh
|
||||
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
|
||||
#
|
||||
# Distributed under terms of the MIT license.
|
||||
#
|
||||
|
||||
# Service statuses
|
||||
if command -v systemctl > /dev/null 2>&1; then
|
||||
len=20
|
||||
printf "Services:\n"
|
||||
for unit in \
|
||||
9iron-backup \
|
||||
ansible-pull
|
||||
do
|
||||
systemctl status $unit > /dev/null 2>&1
|
||||
case $? in
|
||||
0)
|
||||
printf " * %-${len}.${len}s\e[32mRunning\e[0m\n" $unit
|
||||
;;
|
||||
1|2)
|
||||
printf " * %-${len}.${len}s\e[31mDead\e[0m\n" $unit
|
||||
;;
|
||||
3)
|
||||
printf " * %-${len}.${len}s\e[34mExited\e[0m\n" $unit
|
||||
;;
|
||||
*)
|
||||
printf " * %-${len}.${len}s\e[33mUnknown\e[0m\n" "$unit"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user