2019-09-19 10:43:17 +02:00
|
|
|
# install clamav
|
|
|
|
|
# we run freshclam (with daemons stopped) and then starting the daemons should work
|
|
|
|
|
# (avoiding 'clamav-daemon not started: "ConditionPathExistsGlob=/var/lib/clamav/daily.{c[vl]d,inc} was not met"')
|
|
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Install clamav
|
|
|
|
|
ansible.builtin.apt:
|
2019-09-19 10:43:17 +02:00
|
|
|
name: "{{ packages }}"
|
|
|
|
|
vars:
|
|
|
|
|
packages:
|
2026-03-22 13:09:26 +01:00
|
|
|
- clamav
|
|
|
|
|
- clamav-daemon
|
|
|
|
|
- clamav-freshclam
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Stop clamav daemons
|
|
|
|
|
ansible.builtin.systemd:
|
2019-09-19 10:43:17 +02:00
|
|
|
name: "{{ item }}"
|
|
|
|
|
state: stopped
|
|
|
|
|
loop:
|
|
|
|
|
- clamav-freshclam
|
|
|
|
|
- clamav-daemon
|
|
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Run freshclam
|
|
|
|
|
ansible.builtin.command: freshclam
|
|
|
|
|
register: out
|
|
|
|
|
changed_when: out.rc != 0
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Start clamav daemons
|
|
|
|
|
ansible.builtin.systemd:
|
2019-09-19 10:43:17 +02:00
|
|
|
name: "{{ item }}"
|
|
|
|
|
state: started
|
|
|
|
|
loop:
|
|
|
|
|
- clamav-daemon
|
|
|
|
|
- clamav-freshclam
|
|
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Install clamdscan
|
|
|
|
|
ansible.builtin.apt:
|
2019-09-19 10:43:17 +02:00
|
|
|
name: "{{ packages }}"
|
|
|
|
|
vars:
|
|
|
|
|
packages:
|
2026-03-22 13:09:26 +01:00
|
|
|
- clamdscan
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Set clamav BytecodeSecurity to Paranoid
|
|
|
|
|
ansible.builtin.lineinfile:
|
2019-09-19 10:43:17 +02:00
|
|
|
path: /etc/clamav/clamd.conf
|
|
|
|
|
regexp: '^BytecodeSecurity'
|
|
|
|
|
line: 'BytecodeSecurity Paranoid'
|
|
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Restart clamav-daemon
|
|
|
|
|
ansible.builtin.systemd:
|
2019-09-19 10:43:17 +02:00
|
|
|
name: clamav-daemon
|
|
|
|
|
state: restarted
|