2023-07-22 22:53:56 +00:00
|
|
|
---
|
|
|
|
- name: Remove default include path to manage configuration via a single template.
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/dovecot/dovecot.conf
|
|
|
|
regexp: '^!include conf.d'
|
|
|
|
line: '#!include conf.d/*.conf'
|
|
|
|
|
|
|
|
- name: Register Dovecot account database
|
|
|
|
ansible.builtin.file:
|
2023-08-11 19:22:29 +00:00
|
|
|
path: "{{ dovecot_passwd_file }}"
|
2023-07-22 22:53:56 +00:00
|
|
|
state: touch
|
|
|
|
owner: root
|
|
|
|
group: dovecot
|
|
|
|
mode: '0640'
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: Ensure mail_home directory (Dovecot)
|
|
|
|
ansible.builtin.file:
|
|
|
|
name: /srv/mail
|
|
|
|
owner: dovecot
|
|
|
|
group: dovecot
|
|
|
|
state: directory
|
|
|
|
mode: '0770'
|
|
|
|
|
|
|
|
- name: Ensure local configuration file is included from dovecot.conf
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/dovecot/dovecot.conf
|
|
|
|
line: '!include_try local.conf'
|
|
|
|
|
|
|
|
- name: Configure Dovecot
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: dovecot.conf.j2
|
|
|
|
dest: /etc/dovecot/local.conf
|
|
|
|
notify: restart dovecot
|
2023-08-11 19:22:29 +00:00
|
|
|
|
|
|
|
- name: Update UID and GID in imap.passwd
|
|
|
|
ansible.builtin.replace:
|
|
|
|
path: "{{ dovecot_passwd_file }}"
|
|
|
|
regexp: '(.*):(\d+):(\d+)$'
|
|
|
|
replace: '\1:{{ maildir_uid }}:{{ maildir_gid }}'
|
|
|
|
when: force_dovecot_passwd_file_maildir_ids
|
2023-08-21 16:20:49 +00:00
|
|
|
notify: restart dovecot
|
|
|
|
|
|
|
|
- name: Ensure dovecot service is started and enabled.
|
|
|
|
ansible.builtin.service:
|
|
|
|
name: dovecot
|
|
|
|
state: started
|
|
|
|
enabled: yes
|