Files
ansible_role_mail/defaults/main.yml
Luciano Giacchetta f76e0a31ae feat(postfix): implement virtual mailbox configuration for Dovecot LMTP
Updates the Postfix configuration to correctly handle virtual domains when Dovecot LMTP is enabled, moving away from local system delivery settings.

- Removes `postfix_mail_domain` from `postfix_mydestination` to prevent conflicts with virtual domain handling.
- Updates `main.cf` to set `virtual_transport`, `virtual_mailbox_domains`, and `virtual_mailbox_maps` instead of `mailbox_transport`.
- Adds a new template `virtual_mailbox_maps.j2` to authorize specific users defined in `dovecot_users`.
- Adds tasks to generate the virtual mailbox map file and run `postmap` upon changes.
2026-02-11 14:49:22 -03:00

69 lines
2.7 KiB
YAML

#
# Default variables for the role. These can be overridden in your inventory
# or playbook to customize the deployment.
#
# The Internet protocols Postfix will attempt to use when making or accepting connections. Specify one or more of "ipv4" or "ipv6", separated by whitespace or commas.
# The form "all" is equivalent to "ipv4, ipv6" or "ipv4", depending on whether the operating system implements IPv6.
postfix_inet_protocols: "all"
# The local network interface addresses that this mail system receives mail on. Specify "all" to receive mail on all network interfaces (default),
# "loopback-only" to receive mail on loopback network interfaces only (Postfix version 2.2 and later), or zero or more IPv4 or IPv6 addresses
# (IPv6 is supported in Postfix version 2.2 and later)
postfix_inet_interfaces: "all"
# The primary mail domain for this server.
postfix_mail_domain: "{{ ansible_domain | default('internal.local') }}"
# The Fully Qualified Domain Name of the mail server.
postfix_myhostname: "mail.{{ postfix_mail_domain }}"
# Comma-separated list of domains this server accepts mail for locally.
# When using Dovecot with LMTP (virtual mailboxes), the mail domain is handled
# separately via virtual_mailbox_domains, so it should NOT be included here.
postfix_mydestination: "$myhostname, localhost.{{ postfix_mail_domain }}, localhost"
# The list of "trusted" remote SMTP clients that have more privileges than "strangers".
postfix_mynetworks: "127.0.0.0/8 [::1]/128"
# The relayhost (smarthost) for all outgoing mail.
# This variable MUST be set for the role to work as intended.
# Example: "[smtp.sendgrid.net]:587"
# Note: The square brackets [] are important to prevent MX record lookups.
postfix_relayhost: ""
# Optional credentials for the relayhost. If these are defined,
# SASL authentication will be automatically configured.
# postfix_relayhost_user: "apikey"
# postfix_relayhost_password: "YourVeryLongAndComplexApiKey"
# --- Dovecot Configuration ---
# Whether to install and configure Dovecot
dovecot_enabled: true
# Protocols to enable (imap, pop3, lmtp)
dovecot_protocols: "imap pop3 lmtp"
# Mail storage location. Using Maildir in the user's home directory.
dovecot_mail_location: "maildir:~/Maildir"
# SSL/TLS configuration
# Use 'yes', 'no' or 'required'. 'required' is recommended for production.
dovecot_ssl: "yes"
dovecot_ssl_cert: "</etc/ssl/certs/ssl-cert-snakeoil.pem"
dovecot_ssl_key: "</etc/ssl/private/ssl-cert-snakeoil.key"
# Authentication mechanisms
dovecot_auth_mechanisms: "plain login"
# Postfix integration
dovecot_postfix_sasl_enable: true
dovecot_postfix_lmtp_enable: true
# Local Dovecot Users
# Example:
# dovecot_users:
# - name: "service1"
# pass: "secret123"
dovecot_users: []