From e342d39c419740f721ddebdd1b3e5c822aba4ee7 Mon Sep 17 00:00:00 2001 From: jack Date: Mon, 23 Mar 2026 04:02:13 +0700 Subject: [PATCH] fix(snappymail): configure csrx.ru domain with correct IMAP/SMTP server SnappyMail defaulted to localhost:143 for IMAP. Create csrx.ru.json domain config pointing to the mailserver container (shared front network): - IMAP: mailserver:993 SSL - SMTP: mailserver:587 STARTTLS with auth Co-Authored-By: Claude Sonnet 4.6 --- roles/tools/tasks/main.yml | 79 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/roles/tools/tasks/main.yml b/roles/tools/tasks/main.yml index e5d0391..71dd61f 100644 --- a/roles/tools/tasks/main.yml +++ b/roles/tools/tasks/main.yml @@ -211,6 +211,85 @@ when: snappymail_pw_result.changed changed_when: true +# ── SnappyMail domain config for csrx.ru ───────────────────────────────────── +# Points IMAP/SMTP to the mailserver container (shared `front` Docker network). +# type: 0=plain, 1=SSL, 2=STARTTLS +- name: Deploy SnappyMail domain config for {{ domain_base }} + ansible.builtin.copy: + content: | + { + "IMAP": { + "host": "mailserver", + "port": 993, + "type": 1, + "timeout": 300, + "shortLogin": false, + "lowerLogin": true, + "sasl": ["PLAIN", "LOGIN"], + "ssl": { + "verify_peer": false, + "verify_peer_name": false, + "allow_self_signed": true, + "SNI_enabled": true, + "disable_compression": true, + "security_level": 0 + }, + "disabled_capabilities": [], + "use_expunge_all_on_delete": false, + "fast_simple_search": true, + "force_select": false, + "message_all_headers": false, + "message_list_limit": 10000, + "search_filter": "" + }, + "SMTP": { + "host": "mailserver", + "port": 587, + "type": 2, + "timeout": 60, + "shortLogin": false, + "lowerLogin": true, + "sasl": ["PLAIN", "LOGIN"], + "ssl": { + "verify_peer": false, + "verify_peer_name": false, + "allow_self_signed": true, + "SNI_enabled": true, + "disable_compression": true, + "security_level": 0 + }, + "useAuth": true, + "setSender": true, + "usePhpMail": false + }, + "Sieve": { + "enabled": false, + "host": "mailserver", + "port": 4190, + "type": 0, + "timeout": 10, + "shortLogin": false, + "lowerLogin": true, + "sasl": ["PLAIN"], + "ssl": { + "verify_peer": false, + "verify_peer_name": false, + "allow_self_signed": true + } + }, + "whiteList": "" + } + dest: "{{ tools_root }}/snappymail/data/_data_/_default_/domains/{{ domain_base }}.json" + owner: "82" + group: "82" + mode: "0640" + register: snappymail_domain_result + +- name: Restart SnappyMail after domain config update + ansible.builtin.command: docker restart snappymail + when: snappymail_domain_result.changed + changed_when: true + # ── Mail accounts (idempotent: check host-side config file) ────────────────── - name: Wait for mailserver to be ready ansible.builtin.command: docker exec mailserver postfix status