31 lines
944 B
YAML
31 lines
944 B
YAML
|
# vim: ft=yaml.ansible
|
||
|
---
|
||
|
- name: Create Docker network for Postfix
|
||
|
community.docker.docker_network:
|
||
|
name: postfix
|
||
|
state: present
|
||
|
|
||
|
- name: Create Postfix volume directories
|
||
|
ansible.builtin.file:
|
||
|
name: "{{ services.postfix.volume }}/dkim"
|
||
|
owner: root
|
||
|
mode: u=rwx,g=rx,o=rx
|
||
|
state: directory
|
||
|
|
||
|
- name: Deploy Postfix Docker container
|
||
|
community.docker.docker_container:
|
||
|
name: postfix
|
||
|
state: "{{ 'absent' if down is defined and down else 'started' }}"
|
||
|
restart: "{{ restart is defined and restart }}"
|
||
|
recreate: "{{ recreate is defined and recreate }}"
|
||
|
image: boky/postfix:{{ services.postfix.version }}
|
||
|
restart_policy: always
|
||
|
env:
|
||
|
ALLOWED_SENDER_DOMAINS: "{{ sender_domains | join(' ') }}"
|
||
|
HOSTNAME: "{{ services.postfix.domain }}"
|
||
|
DKIM_AUTOGENERATE: "true"
|
||
|
networks:
|
||
|
- name: postfix
|
||
|
volumes:
|
||
|
- "{{ services.postfix.volume }}/dkim:/etc/opendkim/keys:rw"
|