feat: add support for Dovecot IMAP/POP3 configuration

Introduces functionality to install and configure Dovecot alongside Postfix to provide IMAP/POP3 services.

Changes include:
- Added tasks to install Dovecot packages (core, imapd, pop3d, lmtpd).
- Added templates for main configuration and conf.d files (auth, master, ssl, mail).
- Defined default variables for protocols, SSL settings, and Maildir location.
- Enabled Postfix SASL and LMTP integration options.
- Added a handler to restart the Dovecot service.
- Updated README.md with the new configuration variables and usage instructions.
This commit is contained in:
2026-02-10 17:24:59 -03:00
parent 2861687888
commit 87ce53d1d3
12 changed files with 181 additions and 3 deletions

View File

@@ -52,4 +52,41 @@
notify: Restart Postfix
tags:
- postfix_config
- postfix_smarthost
- postfix_smarthost
- name: "DOVECOT | Install Dovecot packages"
when: dovecot_enabled | default(false)
ansible.builtin.apt:
name: "{{ ['dovecot-core', 'dovecot-imapd', 'dovecot-pop3d'] + (['dovecot-lmtpd'] if dovecot_postfix_lmtp_enable | default(false) else []) }}"
state: present
tags:
- dovecot_install
- name: "DOVECOT | Configure dovecot.conf"
when: dovecot_enabled | default(false)
ansible.builtin.template:
src: dovecot.conf.j2
dest: /etc/dovecot/dovecot.conf
owner: root
group: dovecot
mode: '0644'
notify: Restart Dovecot
tags:
- dovecot_config
- name: "DOVECOT | Configure conf.d files"
when: dovecot_enabled | default(false)
ansible.builtin.template:
src: "{{ item.src }}"
dest: "/etc/dovecot/conf.d/{{ item.dest }}"
owner: root
group: dovecot
mode: '0644'
loop:
- { src: '10-auth.conf.j2', dest: '10-auth.conf' }
- { src: '10-master.conf.j2', dest: '10-master.conf' }
- { src: '10-ssl.conf.j2', dest: '10-ssl.conf' }
- { src: '10-mail.conf.j2', dest: '10-mail.conf' }
notify: Restart Dovecot
tags:
- dovecot_config