Skip to content

Commit

Permalink
Log Rotate Clean Task
Browse files Browse the repository at this point in the history
- Add task to "clean" Log Rotate legacy entries
- Allows this to be called separate of install and purge
- logrotate-clean tag added
  • Loading branch information
JKTUNING committed Jan 3, 2024
1 parent 31da96b commit 032a609
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
7 changes: 7 additions & 0 deletions roles/logrotate/tasks/logrotate-clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Ensure Old Entries Removed
ansible.builtin.file:
path: "/etc/logrotate.d/{{ item.name }}"
state: absent
force: true
loop: "{{ logrotate.legacy }}"
7 changes: 0 additions & 7 deletions roles/logrotate/tasks/logrotate-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,3 @@
group: root
mode: "0644"
loop: "{{ logrotate.service }}"

- name: Ensure Old Entries Removed
ansible.builtin.file:
path: "/etc/logrotate.d/{{ item.name }}"
state: absent
force: true
loop: "{{ logrotate.legacy }}"
16 changes: 16 additions & 0 deletions roles/logrotate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@
- logrotate-purge
- purge
- never

- name: Cleanup Log Rotate
ansible.builtin.include_tasks:
file: logrotate-clean.yml
apply:
tags:
- logrotate-install
- logrotate-clean
- logrotate
- all
tags:
- logrotate-install
- logrotate-clean
- logrotate
- all
- never

0 comments on commit 032a609

Please sign in to comment.