Add virusfilter support to Samba shares and configure ClamAV database checks
This commit is contained in:
@@ -58,6 +58,43 @@
|
||||
- samba-server
|
||||
- samba-virusfilter
|
||||
|
||||
- name: (samba-install.yml) Check if ClamAV virus databases are present
|
||||
find:
|
||||
paths: /var/lib/clamav
|
||||
patterns:
|
||||
- "*.cvd"
|
||||
- "*.cld"
|
||||
register: clamav_db_files
|
||||
when:
|
||||
- inventory_hostname in groups['samba_server']
|
||||
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
|
||||
tags:
|
||||
- samba-server
|
||||
- samba-virusfilter
|
||||
|
||||
- name: (samba-install.yml) Stop clamav-freshclam service before initial database download
|
||||
service:
|
||||
name: clamav-freshclam
|
||||
state: stopped
|
||||
failed_when: false
|
||||
when:
|
||||
- inventory_hostname in groups['samba_server']
|
||||
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
|
||||
- clamav_db_files.files | length == 0
|
||||
tags:
|
||||
- samba-server
|
||||
- samba-virusfilter
|
||||
|
||||
- name: (samba-install.yml) Download initial ClamAV virus databases via freshclam
|
||||
command: freshclam
|
||||
when:
|
||||
- inventory_hostname in groups['samba_server']
|
||||
- samba_shares | selectattr('vfs_object_virusfilter', 'defined') | selectattr('vfs_object_virusfilter', 'equalto', true) | list | length > 0
|
||||
- clamav_db_files.files | length == 0
|
||||
tags:
|
||||
- samba-server
|
||||
- samba-virusfilter
|
||||
|
||||
- name: (samba-install.yml) Ensure clamav-daemon and clamav-freshclam services are enabled
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
|
||||
Reference in New Issue
Block a user