Add Postfix for email sending

This commit is contained in:
Sam A. 2023-01-14 18:06:21 +01:00
parent d2820859a2
commit 31c5c9e455
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
4 changed files with 38 additions and 2 deletions

View file

@ -1,9 +1,9 @@
# vim: ft=yaml.ansible
---
ssh_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPd/4fQV7CL8/KVwbo/phiV5UdXFBIDlkZ+ps8C7FeRf
hostname: pi
timezone: Europe/Copenhagen
base_domain: sapti.me
hdd_name: storage
hdd_mount_point: /opt/{{ hdd_name }}

View file

@ -1,6 +1,5 @@
# vim: ft=yaml.ansible
---
base_domain: sapti.me
base_volume: "{{ hdd_mount_point }}/apps"
services:
@ -8,6 +7,11 @@ services:
volume: "{{ base_volume }}/caddy"
version: 2-alpine
postfix:
volume: "{{ base_volume }}/postfix"
hostname: smtp.{{ base_domain }}
version: latest-alpine
emby:
domain: watch.{{ base_domain }}
volume: "{{ base_volume }}/emby"
@ -38,3 +42,6 @@ services:
watchtower:
version: arm64v8-1.5.1
sender_domains:
- "{{ services.nextcloud.domain }}"

View file

@ -76,6 +76,7 @@
PHP_UPLOAD_LIMIT: 16G
networks:
default:
postfix:
services:
aliases:
- nextcloud
@ -88,5 +89,7 @@
- redis
networks:
postfix:
external: true
services:
external: true

View file

@ -0,0 +1,26 @@
# vim: ft=yaml.ansible
---
- name: Create Docker network for Postfix
docker_network:
name: postfix
- name: Create Postfix volume directories
file:
name: "{{ services.postfix.volume }}/dkim"
owner: root
mode: u=rwx,g=rx,o=rx
state: directory
- name: Deploy Postfix Docker container
docker_container:
name: postfix
image: boky/postfix:{{ services.postfix.version }}
restart_policy: always
env:
ALLOWED_SENDER_DOMAINS: "{{ sender_domains | join(' ') }}"
HOSTNAME: "{{ services.postfix.hostname }}"
DKIM_AUTOGENERATE: "true"
networks:
- name: postfix
volumes:
- "{{ services.postfix.volume }}/dkim:/etc/opendkim/keys:rw"