data.coop-ansible/roles/docker/tasks/services/postfix.yml

29 lines
994 B
YAML
Raw Normal View History

# vim: ft=yaml.ansible
---
2023-01-05 15:10:44 +00:00
- name: Set up network for postfix
docker_network:
name: postfix
ipam_config:
- subnet: '172.16.0.0/16'
gateway: 172.16.0.1
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
docker_container:
name: postfix
image: boky/postfix:{{ services.postfix.version }}
restart_policy: always
networks:
- name: postfix
2023-01-05 15:10:44 +00:00
volumes:
- "{{ services.postfix.volume_folder }}/dkim:/etc/opendkim/keys"
env:
# Get all services which have allowed_sender_domain defined
2023-07-11 18:42:20 +00:00
ALLOWED_SENDER_DOMAINS: "{{ base_domain }} {{ 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
2023-01-05 15:10:44 +00:00
DKIM_AUTOGENERATE: "true"