feat: move motd cleanup to debian specific block
This commit is contained in:
parent
73690dbf11
commit
f89ecf464d
1 changed files with 19 additions and 17 deletions
|
|
@ -4,25 +4,27 @@
|
||||||
tags: "motd"
|
tags: "motd"
|
||||||
block:
|
block:
|
||||||
|
|
||||||
# find old motd files
|
# cleanup old motd debian
|
||||||
- name: "motd - find old scripts"
|
- name: "cleanup old motd debian"
|
||||||
ansible.builtin.find:
|
|
||||||
paths: "/etc/update-motd.d/"
|
|
||||||
file_type: "file"
|
|
||||||
excludes:
|
|
||||||
- "10-custom-motd"
|
|
||||||
register: "old_motd"
|
|
||||||
when: "ansible_os_family == 'Debian'"
|
when: "ansible_os_family == 'Debian'"
|
||||||
|
block:
|
||||||
|
|
||||||
# remove old custom motd files
|
# find old motd files
|
||||||
- name: "motd - cleanup directory"
|
- name: "motd - find old scripts"
|
||||||
ansible.builtin.file:
|
ansible.builtin.find:
|
||||||
path: "{{ item.path }}"
|
paths: "/etc/update-motd.d/"
|
||||||
state: "absent"
|
file_type: "file"
|
||||||
loop: "{{ old_motd.files }}"
|
excludes:
|
||||||
when:
|
- "10-custom-motd"
|
||||||
- "old_motd.files|length > 0"
|
register: "old_motd"
|
||||||
- "ansible_os_family == 'Debian'"
|
|
||||||
|
# remove old custom motd files
|
||||||
|
- name: "motd - cleanup directory"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: "absent"
|
||||||
|
loop: "{{ old_motd.files }}"
|
||||||
|
when: "old_motd.files|length > 0"
|
||||||
|
|
||||||
# remove old motd files
|
# remove old motd files
|
||||||
- name: "motd - cleanup main file"
|
- name: "motd - cleanup main file"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue