diff --git a/deploy-tws-motd b/deploy-tws-motd index ada29e8..9acd8ae 100644 --- a/deploy-tws-motd +++ b/deploy-tws-motd @@ -1,5 +1,5 @@ --- -- name: Deploy TWS MOTD (authoritative) +- name: Deploy TWS MOTD hosts: all become: true @@ -8,11 +8,7 @@ tws_short: "TWS" tasks: - # ---------------------------- - # MOTD PIPELINE SANITIZATION - # ---------------------------- - - - name: Remove static Debian MOTD + - name: Remove static MOTD file (Debian default) file: path: /etc/motd state: absent @@ -23,42 +19,20 @@ dest: /etc/motd state: link - - name: Disable Proxmox profile banner + - name: Check for default Ubuntu MOTD scripts + stat: + path: "/etc/update-motd.d/{{ item }}" + loop: + - 10-help-text + - 50-motd-news + register: motd_scripts + + - name: Disable default Ubuntu MOTD noise file: - path: /etc/profile.d/pve.sh - state: absent - ignore_errors: true - - # Debian runs pam_motd twice — we disable the login path - - name: Disable pam_motd in login (prevents duplicate MOTD) - replace: - path: /etc/pam.d/login - regexp: '^(session\s+optional\s+pam_motd.so.*)$' - replace: '# \1' - ignore_errors: true - - # ---------------------------- - # DISABLE DEFAULT MOTD SCRIPTS - # ---------------------------- - - - name: Find default MOTD scripts - find: - paths: /etc/update-motd.d - file_type: file - patterns: - - "10-help-text" - - "50-motd-news" - register: motd_noise - - - name: Disable default MOTD noise - file: - path: "{{ item.path }}" + path: "{{ item.stat.path }}" mode: "0644" - loop: "{{ motd_noise.files }}" - - # ---------------------------- - # DEPLOY TWS MOTD - # ---------------------------- + loop: "{{ motd_scripts.results }}" + when: item.stat.exists - name: Deploy TWS MOTD script copy: @@ -69,6 +43,7 @@ ORG="{{ tws_org }}" SHORT="{{ tws_short }}" + WIDTH=58 line() {