WIP: Setup of a mail server #9
1 changed files with 51 additions and 0 deletions
51
roles/dovecot/tasks/main.yml
Normal file
51
roles/dovecot/tasks/main.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
# Install and configure Dovecot
|
||||||
|
- name: Install Dovecot
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- dovecot-core
|
||||||
|
- dovecot-imapd
|
||||||
|
- dovecot-managesieved
|
||||||
|
- dovecot-lmtpd
|
||||||
|
- dovecot-ldap
|
||||||
|
- dovecot-pop3d
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
# Create the vmail user with UID and GID 5000
|
||||||
|
- name: Create vmail user
|
||||||
|
user:
|
||||||
|
name: vmail
|
||||||
|
uid: 5000
|
||||||
|
gid: 5000
|
||||||
|
home: /var/vmail
|
||||||
|
|
||||||
|
# Create mail user seive directory with right ownernship and rights
|
||||||
|
- name: Create mail user sieve directory
|
||||||
|
file:
|
||||||
|
path: /var/vmail/sieve/global
|
||||||
|
state: directory
|
||||||
|
owner: vmail
|
||||||
|
group: vmail
|
||||||
|
mode: 0770
|
||||||
|
|
||||||
|
# Do the same for mailboxes
|
||||||
|
- name: Create mail user mailbox directory
|
||||||
|
file:
|
||||||
|
path: /var/vmail/mailboxes
|
||||||
|
state: directory
|
||||||
|
owner: vmail
|
||||||
|
group: vmail
|
||||||
|
mode: 0770
|
||||||
|
|
||||||
|
# Add the Dovecot configuration files
|
||||||
|
- name: Add Dovecot configuration
|
||||||
|
template:
|
||||||
|
src: "{{ item }}.j2"
|
||||||
|
dest: "/etc/dovecot/conf.d/{{ item }}"
|
||||||
|
mode: 0644
|
||||||
|
notify: Reload dovecot
|
||||||
|
loop:
|
||||||
|
- "10-auth.conf"
|
||||||
|
- "10-mail.conf"
|
||||||
|
- "10-master.conf"
|
||||||
|
- "10-ssl.conf"
|
Loading…
Reference in a new issue