summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-05-23 00:28:37 +0200
committerGuilhem Moulin <guilhem@fripost.org>2016-05-23 01:07:18 +0200
commit4b59f7a4cfe0f84e2084f01671982b7713a534aa (patch)
treec45803940d32ccd2c1003e311ba28467b9d34a4e
parent7525e4c5dedea932491c80c3a5b597435a1e351f (diff)
Dovecot imapc: don't hardcode the master IMAP server's IP.
-rw-r--r--IMAP.yml5
-rw-r--r--roles/IMAP-proxy/tasks/main.yml14
-rw-r--r--roles/IMAP-proxy/templates/etc/dovecot/conf.d/20-imapc.conf.j2 (renamed from roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf)9
-rw-r--r--roles/IMAP-proxy/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2 (renamed from roles/IMAP-proxy/files/etc/dovecot/conf.d/auth-imap.conf.ext)2
4 files changed, 22 insertions, 8 deletions
diff --git a/IMAP.yml b/IMAP.yml
index 1e55091..5f2a2a3 100644
--- a/IMAP.yml
+++ b/IMAP.yml
@@ -3,11 +3,14 @@
hosts: IMAP
roles:
- { role: IMAP, inst: IMAP }
+ tags:
+ - imap
+ - dovecot
- name: Configure IMAP proxies
hosts: webmail:!IMAP
roles:
- - IMAP-proxy
+ - { role: IMAP-proxy, imapsvr: "{{ hostvars[groups.IMAP[0]] }}" }
tags:
- imap
- dovecot
diff --git a/roles/IMAP-proxy/tasks/main.yml b/roles/IMAP-proxy/tasks/main.yml
index 579fc7e..93a5181 100644
--- a/roles/IMAP-proxy/tasks/main.yml
+++ b/roles/IMAP-proxy/tasks/main.yml
@@ -24,13 +24,23 @@
dest=/etc/dovecot/conf.d/{{ item }}
owner=root group=root
mode=0644
- register: r
+ register: r1
with_items:
- 10-auth.conf
- 10-logging.conf
- 10-mail.conf
- 10-master.conf
- 15-mailboxes.conf
+ notify:
+ - Restart Dovecot
+
+- name: Configure Dovecot (2)
+ template: src=etc/dovecot/conf.d/{{ item }}.j2
+ dest=/etc/dovecot/conf.d/{{ item }}
+ owner=root group=root
+ mode=0644
+ register: r2
+ with_items:
- 20-imapc.conf
- auth-imap.conf.ext
notify:
@@ -38,7 +48,7 @@
- name: Start Dovecot
service: name=dovecot state=started
- when: not r.changed
+ when: not (r1.changed or r2.changed)
- meta: flush_handlers
diff --git a/roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/20-imapc.conf.j2
index 4c1cf8f..39dbbd6 100644
--- a/roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf
+++ b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/20-imapc.conf.j2
@@ -2,16 +2,17 @@
#
# http://dovecot.org/pipermail/dovecot/2011-January/056975.html
# http://wiki2.dovecot.org/HowTo/ImapcProxy
+# http://wiki2.dovecot.org/MailboxFormat/imapc
# http://wiki2.dovecot.org/Migration/Dsync
-imapc_host = localhost
-imapc_port = 993
+imapc_host = {{ ipsec[imapsvr.inventory_hostname_short] }}
+imapc_port = 143
# Read multiple mails in parallel, improves performance
mail_prefetch_count = 25
-# The list of valid features can be found there
-# http://hg.dovecot.org/dovecot-2.2/file/tip/src/lib-storage/index/imapc/imapc-settings.c
+# The list of valid features can be found at
+# https://github.com/dovecot/core/blob/master/src/lib-storage/index/imapc/imapc-settings.c
# (in the struct 'imapc_feature_list imapc_feature_list')
imapc_features = rfc822.size fetch-headers
#imapc_features = rfc822.size fetch-headers search
diff --git a/roles/IMAP-proxy/files/etc/dovecot/conf.d/auth-imap.conf.ext b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2
index ced2f80..30b8d7f 100644
--- a/roles/IMAP-proxy/files/etc/dovecot/conf.d/auth-imap.conf.ext
+++ b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2
@@ -4,7 +4,7 @@
passdb {
driver = imap
- args = host=localhost port=993
+ args = host={{ ipsec[imapsvr.inventory_hostname_short] }} port=143
default_fields = userdb_imapc_password=%w
}