Delete failed freshclam updates >= 1 day old...
This commit is contained in:
		| @@ -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' | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user