feat: move motd cleanup to debian specific block

This commit is contained in:
Simon Cornet 2025-10-25 14:50:39 +02:00
commit f89ecf464d

View file

@ -2,6 +2,11 @@
- name: "manage motd" - name: "manage motd"
tags: "motd" tags: "motd"
block:
# cleanup old motd debian
- name: "cleanup old motd debian"
when: "ansible_os_family == 'Debian'"
block: block:
# find old motd files # find old motd files
@ -12,7 +17,6 @@
excludes: excludes:
- "10-custom-motd" - "10-custom-motd"
register: "old_motd" register: "old_motd"
when: "ansible_os_family == 'Debian'"
# remove old custom motd files # remove old custom motd files
- name: "motd - cleanup directory" - name: "motd - cleanup directory"
@ -20,9 +24,7 @@
path: "{{ item.path }}" path: "{{ item.path }}"
state: "absent" state: "absent"
loop: "{{ old_motd.files }}" loop: "{{ old_motd.files }}"
when: when: "old_motd.files|length > 0"
- "old_motd.files|length > 0"
- "ansible_os_family == 'Debian'"
# remove old motd files # remove old motd files
- name: "motd - cleanup main file" - name: "motd - cleanup main file"