]> git.ekhem.eu.org Git - turnup.git/commitdiff
Add a script for configuring dovecot.
authorJakub Czajka <jakub@ekhem.eu.org>
Wed, 27 Sep 2023 20:37:12 +0000 (22:37 +0200)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:46:45 +0000 (19:46 +0100)
server/dovecot.yaml [new file with mode: 0644]

diff --git a/server/dovecot.yaml b/server/dovecot.yaml
new file mode 100644 (file)
index 0000000..9762e8d
--- /dev/null
@@ -0,0 +1,83 @@
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+- name: Checkout configuration
+  command: |
+    git --work-tree=/tmp --git-dir=/srv/git/server.git checkout main --force \
+      dovecot/*
+  become: yes
+- name: Install dovecot
+  package:
+    name:
+      - dovecot-imapd
+      - dovecot-lmtpd
+      - dovecot-pgsql
+    state: latest
+  become: yes
+- name: Ensure dovecot directory structure exists
+  file:
+    path: "/etc/dovecot/conf.d"
+    state: directory
+  become: yes
+- name: Copy to /etc/dovecot
+  copy:
+    src: "/tmp/dovecot/{{ item }}"
+    dest: "/etc/dovecot"
+    remote_src: true
+  become: true
+  with_items:
+    - dovecot-dict-auth.conf.ext
+    - dovecot-dict-sql.conf.ext
+    - dovecot-sql.conf.ext
+    - dovecot.conf
+- name: Copy to /etc/dovecot/conf.d
+  copy:
+    src: "/tmp/dovecot/{{ item }}"
+    dest: "/etc/dovecot/conf.d"
+    remote_src: true
+  become: true
+  with_items:
+    - 10-auth.conf
+    - 10-master.conf
+    - 15-mailboxes.conf
+    - 90-plugin.conf
+    - auth-dict.conf.ext
+    - auth-static.conf.ext
+    - 10-director.conf
+    - 10-ssl.conf
+    - 20-imap.conf
+    - 90-quota.conf
+    - auth-master.conf.ext
+    - auth-system.conf.ext
+    - 10-logging.conf
+    - 10-tcpwrapper.conf
+    - 20-lmtp.conf
+    - auth-checkpassword.conf.ext
+    - auth-passwdfile.conf.ext
+    - 10-mail.conf
+    - 15-lda.conf
+    - 90-acl.conf
+    - auth-deny.conf.ext
+    - auth-sql.conf.ext
+- name: Ensure virtual mailbox exists
+  user:
+    name: "vmail"
+    home: "/var/vmail"
+    shell: "/usr/sbin/nologin"
+    password_lock: true
+  become: yes
+- name: Ensure log files exist
+  file:
+    path: "/var/log/{{ item }}"
+    state: touch
+    owner: vmail
+    group: vmail
+  become: yes
+  with_items:
+    - dovecot.log
+    - dovecot-info.log
+- name: Restart dovecot
+  service:
+    name: dovecot
+    state: restarted
+  become: yes