ansible/roles/dovecot/tasks/main.yml

47 lines
901 B
YAML

---
- name: Install dovecot
apt:
name:
- dovecot-core
- dovecot-imapd
- dovecot-lmtpd
- dovecot-managesieved
- dovecot-sieve
- name: Create group vmail for dovecot
group:
name: vmail
- name: Create account vmail for dovecot
user:
group: vmail
home: /srv/mail
name: vmail
password: "!"
system: true
- name: Configure dovecot main configuration
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: "{{ item.group }}"
mode: "{{ item.mode }}"
loop:
- src: dovecot.conf.j2
dest: /etc/dovecot/dovecot.conf
group: root
mode: u=rw,g=,o=
- src: auth.j2
dest: /etc/dovecot/auth
group: dovecot
mode: u=rw,g=r,o=
notify:
- Reload dovecot
- name: Enable and start dovecot
systemd:
name: dovecot.service
state: started
enabled: true
...