From 4b59f7a4cfe0f84e2084f01671982b7713a534aa Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 23 May 2016 00:28:37 +0200 Subject: Dovecot imapc: don't hardcode the master IMAP server's IP. --- .../IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf | 17 ----------------- .../files/etc/dovecot/conf.d/auth-imap.conf.ext | 17 ----------------- roles/IMAP-proxy/tasks/main.yml | 14 ++++++++++++-- .../templates/etc/dovecot/conf.d/20-imapc.conf.j2 | 18 ++++++++++++++++++ .../templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2 | 17 +++++++++++++++++ 5 files changed, 47 insertions(+), 36 deletions(-) delete mode 100644 roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf delete mode 100644 roles/IMAP-proxy/files/etc/dovecot/conf.d/auth-imap.conf.ext create mode 100644 roles/IMAP-proxy/templates/etc/dovecot/conf.d/20-imapc.conf.j2 create mode 100644 roles/IMAP-proxy/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2 (limited to 'roles/IMAP-proxy') diff --git a/roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf b/roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf deleted file mode 100644 index 4c1cf8f..0000000 --- a/roles/IMAP-proxy/files/etc/dovecot/conf.d/20-imapc.conf +++ /dev/null @@ -1,17 +0,0 @@ -# Smart IMAP proxying with imapc storage -# -# http://dovecot.org/pipermail/dovecot/2011-January/056975.html -# http://wiki2.dovecot.org/HowTo/ImapcProxy -# http://wiki2.dovecot.org/Migration/Dsync - -imapc_host = localhost -imapc_port = 993 - -# 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 -# (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/files/etc/dovecot/conf.d/auth-imap.conf.ext deleted file mode 100644 index ced2f80..0000000 --- a/roles/IMAP-proxy/files/etc/dovecot/conf.d/auth-imap.conf.ext +++ /dev/null @@ -1,17 +0,0 @@ -# Authentication via remote IMAP server. Included from auth.conf. -# -# - -passdb { - driver = imap - args = host=localhost port=993 - default_fields = userdb_imapc_password=%w -} - -# "prefetch" user database means that the passdb already provided the -# needed information and there's no need to do a separate userdb lookup. -# -userdb { - driver = prefetch - default_fields = home=/var/lib/imapproxy/%d/%n -} 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/templates/etc/dovecot/conf.d/20-imapc.conf.j2 b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/20-imapc.conf.j2 new file mode 100644 index 0000000..39dbbd6 --- /dev/null +++ b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/20-imapc.conf.j2 @@ -0,0 +1,18 @@ +# Smart IMAP proxying with imapc storage +# +# 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 = {{ 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 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/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2 b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2 new file mode 100644 index 0000000..30b8d7f --- /dev/null +++ b/roles/IMAP-proxy/templates/etc/dovecot/conf.d/auth-imap.conf.ext.j2 @@ -0,0 +1,17 @@ +# Authentication via remote IMAP server. Included from auth.conf. +# +# + +passdb { + driver = imap + args = host={{ ipsec[imapsvr.inventory_hostname_short] }} port=143 + default_fields = userdb_imapc_password=%w +} + +# "prefetch" user database means that the passdb already provided the +# needed information and there's no need to do a separate userdb lookup. +# +userdb { + driver = prefetch + default_fields = home=/var/lib/imapproxy/%d/%n +} -- cgit v1.2.3