--- # file: roles/base/tasks/core_motd.yml - name: "Configure standard MOTD" block: - name: Disable unnecessary MOTD files file: path: "{{ item }}" mode: 644 with_items: - "/etc/update-motd.d/00-header" - "/etc/update-motd.d/10-help-text" - "/etc/update-motd.d/50-motd-news" - "/etc/update-motd.d/50-landscape-sysinfo" when: ansible_os_family == "Debian" - name: Disable motd-news service in config file ansible.builtin.lineinfile: path: /etc/default/motd-news regexp: ^ENABLED= line: "ENABLED=0" when: ansible_os_family == "Debian" notify: - Reboot Host - name: Disable motd-news timer service: name: motd-news.timer state: stopped enabled: no when: ansible_os_family == "Debian" - name: Install the MOTD Script template: src: motd.j2 dest: /etc/profile.d/login-info.sh - name: Configure SSH to not use the default MOTD lineinfile: path: /etc/ssh/sshd_config regexp: '^#?PrintMotd ' line: PrintMotd no notify: - Restart SSH when: base_core_motd_enabled == true