ansible-role-mailserver/tasks/dovecot.yml

73 lines
1.5 KiB
YAML

- name: dovecot - install
package:
state: latest
name:
- dovecot
- pigeonhole
- name: dovecot - generate DH
notify: restart dovecot
openssl_dhparam:
path: /etc/dovecot/dh.pem
size: 4096
- name: dovecot - create config folder
notify: restart dovecot
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /etc/dovecot
- /etc/dovecot/conf.d
- name: dovecot - take default config
notify: restart dovecot
copy:
remote_src: yes
src: "/usr/share/doc/dovecot/example-config/{{ item }}"
dest: "/etc/dovecot/{{ item }}"
with_items:
- conf.d/auth-sql.conf.ext
- name: dovecot - config
notify: restart dovecot
template:
src: "dovecot/{{ item }}"
dest: "/etc/dovecot/{{ item }}"
with_items:
- dovecot-sql.conf.ext
- dovecot.conf
- conf.d/10-auth.conf
- conf.d/10-mail.conf
- conf.d/10-master.conf
- conf.d/10-ssl.conf
- conf.d/15-mailboxes.conf
- conf.d/20-imap.conf
- conf.d/20-lmtp.conf
- conf.d/20-managesieve.conf
- conf.d/90-quota.conf
- conf.d/90-sieve.conf
- conf.d/91-stats.conf
- name: dovecot - create sieve folder
file:
path: /srv/mail/sieve
state: directory
owner: vmail
group: vmail
- name: dovecot - sieve default spam
copy:
src: dovecot-spam.sieve
dest: /srv/mail/sieve/spam.sieve
owner: vmail
group: vmail
- name: dovecot - start and enable on boot
systemd:
name: dovecot
enabled: yes
state: started