null-client.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. # http://www.postfix.org/postconf.5.html#smtpd_relay_restrictions
  16. smtpd_relay_restrictions = reject_non_fqdn_recipient, reject_unauth_destination
  17. mydestination =
  18. relay_domains = example.com
  19. # include TLS protocol & cipher in 'Received' header
  20. smtpd_tls_received_header = yes
  21. # + sasl username
  22. smtpd_sasl_authenticated_header = yes
  23. relayhost = relay.example.com:submission
  24. # http://www.postfix.org/MAILLOG_README.html
  25. maillog_file = /dev/stdout
  26. # http://www.postfix.org/COMPATIBILITY_README.html
  27. compatibility_level = 2
  28. dest: '{{ config_volume.ansible_facts.docker_volume.Mountpoint }}/main.cf'
  29. mode: a=r
  30. register: config
  31. - docker_container:
  32. name: postfix
  33. # 1.0.0-postfix3.4.5r0-amd64
  34. image: fphammerle/postfix@sha256:33c2dfc8d292b8399f7c61b206922b81c870ce5ae2c7e233fd1a38d420417154
  35. hostname: postfix-test
  36. volumes:
  37. - '{{ config_volume.ansible_facts.docker_volume.Mountpoint }}/main.cf:/etc/postfix/main.cf:ro'
  38. networks: [name: mail]
  39. purge_networks: yes
  40. published_ports: ['localhost:25:25']
  41. restart_policy: unless-stopped
  42. restart: '{{ config.changed }}'