Add option for not configuring MOTD

This commit is contained in:
Tyler Hale 2022-08-22 13:50:58 -06:00
parent 44d7644dfe
commit 39f6e624f1
Signed by: Tyler
GPG key ID: C7CC4B910D88EF96
2 changed files with 36 additions and 38 deletions

View file

@ -32,6 +32,7 @@
file: core_motd.yml
apply:
tags: motd
when: base_core_motd_enabled == true
tags:
- motd

View file

@ -1,9 +1,7 @@
---
# file: roles/base/tasks/core_motd.yml
- name: "Configure standard MOTD"
block:
- name: Disable unnecessary MOTD files
- name: Disable unnecessary MOTD files
file:
path: "{{ item }}"
mode: 644
@ -14,7 +12,7 @@
- "/etc/update-motd.d/50-landscape-sysinfo"
when: ansible_os_family == "Debian"
- name: Disable motd-news service in config file
- name: Disable motd-news service in config file
ansible.builtin.lineinfile:
path: /etc/default/motd-news
regexp: ^ENABLED=
@ -23,23 +21,22 @@
notify:
- Reboot Host
- name: Disable motd-news timer
- name: Disable motd-news timer
service:
name: motd-news.timer
state: stopped
enabled: no
when: ansible_os_family == "Debian"
- name: Install the MOTD Script
- 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
- 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