Set up DKIM for Postfix

This commit is contained in:
Sam A. 2023-01-05 16:10:44 +01:00
parent 5b2f460cad
commit 99e2d04829
Signed by untrusted user: samsapti
GPG key ID: CBBBE7371E81C4EA
2 changed files with 11 additions and 2 deletions

View file

@ -8,6 +8,7 @@ services:
postfix: postfix:
file: postfix.yml file: postfix.yml
domain: "smtp.{{ base_domain }}" domain: "smtp.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/postfix"
version: "v3.5.1-alpine" version: "v3.5.1-alpine"
nginx_proxy: nginx_proxy:

View file

@ -1,20 +1,28 @@
# vim: ft=yaml.ansible # vim: ft=yaml.ansible
--- ---
- name: setup network for postfix - name: Set up network for postfix
docker_network: docker_network:
name: postfix name: postfix
ipam_config: ipam_config:
- subnet: '172.16.0.0/16' - subnet: '172.16.0.0/16'
gateway: 172.16.0.1 gateway: 172.16.0.1
- name: setup postfix docker container for outgoing mail - name: Create volume folders for Postfix
file:
name: "{{ services.postfix.volume_folder }}/dkim"
state: directory
- name: Set up Postfix Docker container for outgoing mail from services
docker_container: docker_container:
name: postfix name: postfix
image: boky/postfix:{{ services.postfix.version }} image: boky/postfix:{{ services.postfix.version }}
restart_policy: always restart_policy: always
networks: networks:
- name: postfix - name: postfix
volumes:
- "{{ services.postfix.volume_folder }}/dkim:/etc/opendkim/keys"
env: env:
# Get all services which have allowed_sender_domain defined # Get all services which have allowed_sender_domain defined
ALLOWED_SENDER_DOMAINS: "{{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}" ALLOWED_SENDER_DOMAINS: "{{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}"
HOSTNAME: "{{ services.postfix.domain }}" # the name the smtp server will identify itself as HOSTNAME: "{{ services.postfix.domain }}" # the name the smtp server will identify itself as
DKIM_AUTOGENERATE: "true"