ansible-roles/library/roles/clamav/tasks/main.yml

56 lines
2.0 KiB
YAML

---
- name: Install the clamav packages
block:
- name: Install the clamav packages on RH based systems
yum: pkg={{ clamav_rh_pkgs }} state=present
when: clamav_install | bool
- name: Install the clamav unofficial signature packages on RH based systems
yum: pkg={{ clamav_unofficial_sigs_rh_pkgs }} state=present
when: clamav_unofficial_sigs_install | bool
- name: Install the clamav milter packages on RH based systems
yum: pkg={{ clamav_milter_rh_pkgs}} state=present
when: clamav_milter_install | bool
when: ansible_distribution_file_variety == "RedHat"
tags: [ 'clamav', 'clamav_clamd' ]
- name: Configure freshclam and clamd
block:
- name: Install the clamd configuration
template: src=scan.conf.j2 dest={{ clamav_clamd_conf_file }} owner=root group=root mode=0444
notify: Reload clamd
- name: Install the freshclam configuration
template: src=freshclam.conf.j2 dest=/etc/freshclam.conf owner=root group=root mode=0400
- name: Ensure that the clamd service is running and enabled
service: name=clamd@scan state=started enabled=yes
when: clamav_install | bool
tags: [ 'clamav', 'clamav_clamd', 'clamav_config' ]
- name: Configure clamav unofficial sigs
block:
- name: Install the unofficial sigs configuration files
template: src={{ item }}.j2 dest=/etc/clamav-unofficial-sigs/{{ item }} owner=root group=root mode=0444
with_items:
- os.conf
- user.conf
when: clamav_unofficial_sigs_install | bool
tags: [ 'clamav', 'clamav_clamd', 'clamav_config' ]
- name: Configure clamav milter
block:
- name: Install the clamav milter configuration
template: src=clamav-milter.conf.j2 dest=/etc/mail/clamav-milter.conf owner=root group=root mode=0444
notify: Restart clamav-milter
- name: Ensure that clamav milter is running and enabled
service: name=clamav-milter state=started enabled=yes
when: clamav_milter_install | bool
tags: [ 'clamav', 'clamav_clamd', 'clamav_config' ]