2019-09-19 10:43:17 +02:00
|
|
|
# here we assume that postfix.yml has run such that user 'mailstore' exists
|
|
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
|
|
|
|
|
# sieve scripts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install dovecot packages
|
|
|
|
|
ansible.builtin.apt:
|
|
|
|
|
name: dovecot-core,dovecot-flatcurve,dovecot-imapd,dovecot-lmtpd,dovecot-managesieved,dovecot-pgsql,dovecot-sieve
|
2019-09-19 10:43:17 +02:00
|
|
|
state: present
|
|
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Remove inclusion of conf.d/*.conf from dovecot.conf
|
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
|
path: /etc/dovecot/dovecot.conf
|
|
|
|
|
regexp: '^!include conf\.d/\*\.conf'
|
|
|
|
|
line: '#!include conf.d/*.conf'
|
|
|
|
|
|
|
|
|
|
- name: Set dovecot_config_version to 2.4.1
|
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
|
path: /etc/dovecot/dovecot.conf
|
|
|
|
|
regexp: '^dovecot_config_version = .*'
|
|
|
|
|
line: 'dovecot_config_version = 2.4.1'
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Set dovecot_storage_version to 2.4.1
|
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
|
path: /etc/dovecot/dovecot.conf
|
|
|
|
|
regexp: '^dovecot_storage_version = .*'
|
|
|
|
|
line: 'dovecot_storage_version = 2.4.1'
|
|
|
|
|
|
|
|
|
|
- name: Install /etc/dovecot/local.conf
|
|
|
|
|
ansible.builtin.template:
|
2019-09-19 10:43:17 +02:00
|
|
|
src: "dovecot/{{ item }}"
|
|
|
|
|
dest: "/etc/dovecot/{{ item }}"
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
2026-03-22 13:09:26 +01:00
|
|
|
mode: "0600"
|
|
|
|
|
force: true
|
2019-09-19 10:43:17 +02:00
|
|
|
loop:
|
2026-03-22 13:09:26 +01:00
|
|
|
- local.conf
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: File quota-warning.sh
|
|
|
|
|
ansible.builtin.template:
|
|
|
|
|
src: dovecot/quota-warning.sh
|
|
|
|
|
dest: /usr/local/bin/quota-warning.sh
|
2019-09-19 10:43:17 +02:00
|
|
|
owner: root
|
|
|
|
|
group: root
|
2026-03-22 13:09:26 +01:00
|
|
|
mode: "0755"
|
|
|
|
|
force: true
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Directory /var/lib/dovecot/sieve
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
path: "/var/lib/dovecot/sieve"
|
|
|
|
|
state: directory
|
2019-09-19 10:43:17 +02:00
|
|
|
owner: mailstore
|
|
|
|
|
group: mailstore
|
2026-03-22 13:09:26 +01:00
|
|
|
mode: "0755"
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Copy sieve files
|
|
|
|
|
ansible.builtin.copy:
|
|
|
|
|
src: dovecot/sieve
|
|
|
|
|
dest: /var/lib/dovecot/
|
2019-09-19 10:43:17 +02:00
|
|
|
owner: mailstore
|
|
|
|
|
group: mailstore
|
2026-03-22 13:09:26 +01:00
|
|
|
mode: "0600"
|
|
|
|
|
directory_mode: "0755"
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Directory permissions sieve pipes
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
path: "/var/lib/dovecot/sieve/pipes"
|
2019-09-19 10:43:17 +02:00
|
|
|
owner: mailstore
|
|
|
|
|
group: mailstore
|
2026-03-22 13:09:26 +01:00
|
|
|
mode: "0777"
|
2019-09-19 10:43:17 +02:00
|
|
|
|
2026-03-22 13:09:26 +01:00
|
|
|
- name: Execution flag for spam training scripts
|
|
|
|
|
ansible.builtin.file:
|
|
|
|
|
path: "/var/lib/dovecot/sieve/pipes/{{ item }}"
|
2019-09-19 10:43:17 +02:00
|
|
|
owner: mailstore
|
|
|
|
|
group: mailstore
|
2026-03-22 13:09:26 +01:00
|
|
|
mode: "0700"
|
2019-09-19 10:43:17 +02:00
|
|
|
loop:
|
2026-03-22 13:09:26 +01:00
|
|
|
- rspamd-learn-spam.sh
|
|
|
|
|
- rspamd-learn-ham.sh
|
|
|
|
|
|
|
|
|
|
- name: Restart dovecot
|
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
|
name: dovecot
|
|
|
|
|
state: restarted
|