2022-12-29 21:13:31 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2019-02-10 07:59:53 +00:00
|
|
|
---
|
2023-01-05 15:10:44 +00:00
|
|
|
- name: Set up network for postfix
|
2020-03-04 17:05:48 +00:00
|
|
|
docker_network:
|
|
|
|
name: postfix
|
|
|
|
ipam_config:
|
2020-05-29 21:36:07 +00:00
|
|
|
- subnet: '172.16.0.0/16'
|
|
|
|
gateway: 172.16.0.1
|
2020-03-04 17:05:48 +00:00
|
|
|
|
2023-01-05 15:10:44 +00:00
|
|
|
- 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
|
2019-02-10 07:59:53 +00:00
|
|
|
docker_container:
|
|
|
|
name: postfix
|
2022-11-26 08:15:18 +00:00
|
|
|
image: boky/postfix:{{ services.postfix.version }}
|
2022-05-08 11:58:21 +00:00
|
|
|
restart_policy: always
|
2019-02-10 07:59:53 +00:00
|
|
|
networks:
|
|
|
|
- name: postfix
|
2023-01-05 15:10:44 +00:00
|
|
|
volumes:
|
|
|
|
- "{{ services.postfix.volume_folder }}/dkim:/etc/opendkim/keys"
|
2019-02-10 07:59:53 +00:00
|
|
|
env:
|
2022-11-26 08:15:18 +00:00
|
|
|
# Get all services which have allowed_sender_domain defined
|
2022-11-26 21:48:15 +00:00
|
|
|
ALLOWED_SENDER_DOMAINS: "{{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}"
|
2022-11-27 14:01:55 +00:00
|
|
|
HOSTNAME: "{{ services.postfix.domain }}" # the name the smtp server will identify itself as
|
2023-01-05 15:10:44 +00:00
|
|
|
DKIM_AUTOGENERATE: "true"
|