Add option for not configuring MOTD
This commit is contained in:
parent
44d7644dfe
commit
39f6e624f1
2 changed files with 36 additions and 38 deletions
|
@ -32,6 +32,7 @@
|
||||||
file: core_motd.yml
|
file: core_motd.yml
|
||||||
apply:
|
apply:
|
||||||
tags: motd
|
tags: motd
|
||||||
|
when: base_core_motd_enabled == true
|
||||||
tags:
|
tags:
|
||||||
- motd
|
- motd
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,42 @@
|
||||||
---
|
---
|
||||||
# file: roles/base/tasks/core_motd.yml
|
# file: roles/base/tasks/core_motd.yml
|
||||||
|
|
||||||
- name: "Configure standard MOTD"
|
- name: Disable unnecessary MOTD files
|
||||||
block:
|
file:
|
||||||
- name: Disable unnecessary MOTD files
|
path: "{{ item }}"
|
||||||
file:
|
mode: 644
|
||||||
path: "{{ item }}"
|
with_items:
|
||||||
mode: 644
|
- "/etc/update-motd.d/00-header"
|
||||||
with_items:
|
- "/etc/update-motd.d/10-help-text"
|
||||||
- "/etc/update-motd.d/00-header"
|
- "/etc/update-motd.d/50-motd-news"
|
||||||
- "/etc/update-motd.d/10-help-text"
|
- "/etc/update-motd.d/50-landscape-sysinfo"
|
||||||
- "/etc/update-motd.d/50-motd-news"
|
when: ansible_os_family == "Debian"
|
||||||
- "/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:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/default/motd-news
|
path: /etc/default/motd-news
|
||||||
regexp: ^ENABLED=
|
regexp: ^ENABLED=
|
||||||
line: "ENABLED=0"
|
line: "ENABLED=0"
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
notify:
|
notify:
|
||||||
- Reboot Host
|
- Reboot Host
|
||||||
|
|
||||||
- name: Disable motd-news timer
|
- name: Disable motd-news timer
|
||||||
service:
|
service:
|
||||||
name: motd-news.timer
|
name: motd-news.timer
|
||||||
state: stopped
|
state: stopped
|
||||||
enabled: no
|
enabled: no
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
- name: Install the MOTD Script
|
- name: Install the MOTD Script
|
||||||
template:
|
template:
|
||||||
src: motd.j2
|
src: motd.j2
|
||||||
dest: /etc/profile.d/login-info.sh
|
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:
|
lineinfile:
|
||||||
path: /etc/ssh/sshd_config
|
path: /etc/ssh/sshd_config
|
||||||
regexp: '^#?PrintMotd '
|
regexp: '^#?PrintMotd '
|
||||||
line: PrintMotd no
|
line: PrintMotd no
|
||||||
notify:
|
notify:
|
||||||
- Restart SSH
|
- Restart SSH
|
||||||
when: base_core_motd_enabled == true
|
|
||||||
|
|
Loading…
Reference in a new issue