--- - name: Deploy TWS MOTD hosts: all become: true vars: tws_org: "TheWrightServer" tws_short: "TWS" tasks: - name: Disable default Ubuntu MOTD noise file: path: "/etc/update-motd.d/{{ item }}" mode: "0644" loop: - 10-help-text - 50-motd-news ignore_errors: true - name: Deploy TWS MOTD script copy: dest: /etc/update-motd.d/10-tws mode: "0755" content: | #!/bin/bash ORG="{{ tws_org }}" SHORT="{{ tws_short }}" HOSTNAME="$(hostname)" OS="$(lsb_release -ds 2>/dev/null || grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '"')" KERNEL="$(uname -r)" IP="$(hostname -I | awk '{print $1}')" UPTIME="$(uptime -p | sed 's/up //')" LOAD="$(awk '{print $1}' /proc/loadavg)" MEM_USED="$(free -h | awk '/Mem:/ {print $3}')" MEM_TOTAL="$(free -h | awk '/Mem:/ {print $2}')" DISK_USED="$(df -h / | awk 'NR==2 {print $5}')" USERS="$(who | wc -l)" cat <