From 6bc0bc5b285b300ec1adb064a56bbc1de5df5cf4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Sun, 13 Dec 2020 17:35:49 +0100 Subject: [PATCH] Remove the local whitelist file when it's empty. --- tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index a3bfcbd..b31d787 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -43,6 +43,13 @@ - name: Install the local whitelist file template: src=local_whitelist.ign2.j2 dest={{ clamav_signatures_db_dir }}/{{ clamav_signatures_whitelist_file }} owner=clamscan group=clamscan mode='0444' notify: Restart clamd + when: clamav_signatures_whitelist != [] + tags: [ 'clamav', 'clamav_clamd', 'clamav_config', 'clamav_signatures', 'clamav_whitelist' ] + + - name: Remove the local whitelist file if it's empty + file: dest={{ clamav_signatures_db_dir }}/{{ clamav_signatures_whitelist_file }} state=absent + notify: Restart clamd + when: clamav_signatures_whitelist == [] tags: [ 'clamav', 'clamav_clamd', 'clamav_config', 'clamav_signatures', 'clamav_whitelist' ] - name: Install a cron job that wipes the wrong signature files, just in case they reappear after an update