null-client.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. - hosts: [localhost]
  2. become: true
  3. tasks:
  4. - docker_network:
  5. name: mail
  6. - docker_volume:
  7. volume_name: postfix_config
  8. register: config_volume
  9. - name: create config
  10. copy:
  11. content: |
  12. # $myhostname prefix is a RFC requirement
  13. smtpd_banner = $myhostname ESMTP $mail_name quid agis?
  14. # RCPT TO matches $relay_domains => !reject_unauth_destination
  15. smtpd_relay_restrictions = reject_non_fqdn_recipient, reject_unauth_destination
  16. relay_domains = example.com
  17. # include TLS protocol & cipher in 'Received' header
  18. smtpd_tls_received_header = yes
  19. # + sasl username
  20. smtpd_sasl_authenticated_header = yes
  21. relayhost = relay.example.com:submission
  22. # http://www.postfix.org/MAILLOG_README.html
  23. maillog_file = /dev/stdout
  24. # http://www.postfix.org/COMPATIBILITY_README.html
  25. compatibility_level = 2
  26. dest: '{{ config_volume.ansible_facts.docker_volume.Mountpoint }}/main.cf'
  27. mode: a=r
  28. register: config
  29. - docker_container:
  30. name: postfix
  31. # 1.0.0-postfix3.4.5r0-amd64
  32. image: fphammerle/postfix@sha256:33c2dfc8d292b8399f7c61b206922b81c870ce5ae2c7e233fd1a38d420417154
  33. hostname: postfix-test
  34. volumes:
  35. - '{{ config_volume.ansible_facts.docker_volume.Mountpoint }}/main.cf:/etc/postfix/main.cf:ro'
  36. networks: [name: mail]
  37. purge_networks: yes
  38. published_ports: ['localhost:25:25']
  39. restart_policy: unless-stopped
  40. restart: '{{ config.changed }}'