ansible/roles/update_motd/tasks/main.yml

55 lines
1.1 KiB
YAML
Raw Permalink Normal View History

2021-03-06 04:30:32 +01:00
---
2021-03-06 04:42:21 +01:00
- name: Ensure update-motd.d exists
file:
path: /etc/update-motd.d
state: directory
mode: u=rwx,g=rx,o=rx
owner: root
group: root
2021-03-06 04:30:32 +01:00
- name: Customize motd
template:
src: "{{ item }}"
dest: "/etc/update-motd.d/{{ item }}"
mode: u=rwx,g=rx,o=rx
owner: root
group: root
loop:
- 00-logo
- 10-messages
- 20-uname
notify: Remove cached motd
2021-11-22 18:01:21 +01:00
- name: Remove Debian uname motd
file:
path: /etc/update-motd.d/10-uname
state: absent
notify: Remove cached motd
2021-03-06 04:30:32 +01:00
- name: Remove Debian warranty motd
file:
path: /etc/motd
state: absent
notify: Remove cached motd
- name: Ensure motd-messages exists
file:
path: /etc/motd-messages
state: directory
mode: u=rwx,g=rx,o=rx
owner: root
group: root
notify: Remove cached motd
2021-03-06 04:45:00 +01:00
- name: Install additional motd messages
2021-03-06 04:30:32 +01:00
copy:
2021-11-27 19:14:39 +01:00
content: "✨ {{ item.value }}\n"
2021-03-06 04:30:32 +01:00
dest: "/etc/motd-messages/{{ item.key }}"
2021-11-27 19:14:39 +01:00
mode: u=rw,g=r,o=r
2021-03-06 04:30:32 +01:00
owner: root
group: root
2021-11-27 19:14:39 +01:00
loop: "{{ update_motd | dict2items }}"
2021-03-06 04:30:32 +01:00
notify: Remove cached motd
2021-11-27 19:14:39 +01:00
when: update_motd is defined
2021-03-06 04:30:32 +01:00
...