dovecot: Initial version of role
This commit is contained in:
parent
54b0b1da21
commit
04c9be96a4
3 changed files with 99 additions and 0 deletions
6
roles/dovecot/handlers/main.yml
Normal file
6
roles/dovecot/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: restart dovecot
|
||||||
|
service:
|
||||||
|
name: dovecot
|
||||||
|
state: restarted
|
45
roles/dovecot/tasks/main.yml
Normal file
45
roles/dovecot/tasks/main.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: install packages
|
||||||
|
package:
|
||||||
|
name: dovecot
|
||||||
|
state: installed
|
||||||
|
|
||||||
|
- name: install privatekey
|
||||||
|
copy:
|
||||||
|
dest: "{{ tls_private }}/{{ mail_server }}.key"
|
||||||
|
src: "{{ item }}"
|
||||||
|
mode: 0600
|
||||||
|
owner: root
|
||||||
|
grouop: "{{ ansible_wheel }}"
|
||||||
|
with_first_found:
|
||||||
|
- "/srv/letsencrypt/live/{{ mail_server }}/privkey.pem"
|
||||||
|
- "/srv/ca/private/{{ inventory_hostname }}.key"
|
||||||
|
notify: restart dovecot
|
||||||
|
|
||||||
|
- name: install certificate
|
||||||
|
copy:
|
||||||
|
dest: "{{ tls_certs }}/{{ mail_server }}.crt"
|
||||||
|
src: "{{ item }}"
|
||||||
|
mode: 0644
|
||||||
|
owner: root
|
||||||
|
group: "{{ ansible_wheel }}"
|
||||||
|
with_first_found:
|
||||||
|
- "/srv/letsencrypt/live/{{ mail_server }}/fullchain.pem"
|
||||||
|
- "/srv/ca/certs/{{ inventory_hostname }}.crt"
|
||||||
|
notify: restart dovecot
|
||||||
|
|
||||||
|
- name: create local config
|
||||||
|
template:
|
||||||
|
dest: /etc/dovecot/conf.d/99local.conf
|
||||||
|
src: local.conf.j2
|
||||||
|
mode: 0644
|
||||||
|
owner: root
|
||||||
|
group: "{{ ansible_wheel }}"
|
||||||
|
notify: restart dovecot
|
||||||
|
|
||||||
|
- name: enable service
|
||||||
|
service:
|
||||||
|
name: dovecot
|
||||||
|
enabled: true
|
||||||
|
state: started
|
48
roles/dovecot/templates/local.conf.j2
Normal file
48
roles/dovecot/templates/local.conf.j2
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# ssl settings
|
||||||
|
ssl = required
|
||||||
|
ssl_cert = {{ tls_certs }}/{{ mail_server }}.crt
|
||||||
|
ssl_key = {{ tls_private }}/{{ mail_server }}.key
|
||||||
|
|
||||||
|
# kerberos
|
||||||
|
auth_gssapi_hostname = "$ALL"
|
||||||
|
auth_krb5_keytab = /etc/dovecot/dovecot.keytab
|
||||||
|
auth_mechanisms = gssapi plain login
|
||||||
|
|
||||||
|
# use index from tmpfs
|
||||||
|
mail_location = mbox:~/imapmail/:INBOX=/var/mail/%u:INDEX=/var/spool/dovecot/index/home/%u
|
||||||
|
|
||||||
|
# special icons for mailboxes
|
||||||
|
namespace inbox {
|
||||||
|
mailbox spam {
|
||||||
|
special_use = \Junk
|
||||||
|
}
|
||||||
|
mailbox Sent {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Sent
|
||||||
|
}
|
||||||
|
mailbox Trash {
|
||||||
|
auto = subscribe
|
||||||
|
special_use = \Trash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# imap specific
|
||||||
|
protocol imap {
|
||||||
|
mail_max_userip_connections = 20
|
||||||
|
imap_idle_notify_interval = 29 mins
|
||||||
|
}
|
||||||
|
|
||||||
|
# disable plain text imap and pop3
|
||||||
|
service pop3-login {
|
||||||
|
inet_listener pop3 {
|
||||||
|
port = 0
|
||||||
|
}
|
||||||
|
inet_listener pop3s {
|
||||||
|
port = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
service imap-login {
|
||||||
|
inet_listener imap {
|
||||||
|
port = 0
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue