Delete failed freshclam updates >= 1 day old...
This commit is contained in:
parent
6af4607709
commit
0d65e8e562
@ -1,4 +1,4 @@
|
||||
---
|
||||
# defaults file for ensure_clamav
|
||||
quarantine_directory: '/root/quarantine'
|
||||
|
||||
freshclam_retention: '1d'
|
||||
|
@ -123,6 +123,35 @@
|
||||
notify:
|
||||
- 'ensure_clamav.package_facts'
|
||||
- 'ensure_clamav.service_facts'
|
||||
- name: 'find failed freshclam updates...'
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- ensure_clamav is defined
|
||||
- freshclam_retention is defined
|
||||
- freshclam_retention is regex('^[0-9]*[smhdw]$')
|
||||
ansible.builtin.find:
|
||||
age: '{{ freshclam_retention }}'
|
||||
file_type: 'directory'
|
||||
follow: 'no'
|
||||
paths:
|
||||
- '/var/lib/clamav/'
|
||||
patterns:
|
||||
- '^tmp.([0-9]|[a-f}){10}$'
|
||||
recurse: 'yes'
|
||||
register: 'results'
|
||||
- name: 'And drop them'
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- ensure_clamav is defined
|
||||
- freshclam_retention is defined
|
||||
- freshclam_retention is regex('^[0-9]*[smhdw]$')
|
||||
- item.path is regex('^/var/lib/clamav/tmp\.([0-9]|[a-f])*$')
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.path }}'
|
||||
state: 'absent'
|
||||
loop: '{{ results.files }}'
|
||||
loop_control:
|
||||
label: '{{ item.path }} to be removed'
|
||||
- name: 'flush handlers'
|
||||
meta: 'flush_handlers'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user