smtp.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. - name: 'Install Postfix packages'
  2. apt:
  3. pkg: '{{ item }}'
  4. install_recommends: 'no'
  5. state: 'present'
  6. with_items:
  7. - 'postfix'
  8. - 'ca-certificates'
  9. - 'procmail'
  10. - 'libsasl2-modules'
  11. when: with_postfix
  12. tags:
  13. - 'smtp'
  14. - name: 'Install mail aliases file'
  15. template:
  16. src: 'aliases.j2'
  17. dest: '/etc/aliases'
  18. owner: 'root'
  19. group: 'root'
  20. mode: '0644'
  21. notify:
  22. - 'Regenerate aliases cache'
  23. when: with_mail_aliases
  24. tags:
  25. - 'smtp'
  26. - name: 'Install Postfix main configuration'
  27. template:
  28. src: 'postfix/main.cf.j2'
  29. dest: '/etc/postfix/main.cf'
  30. owner: 'root'
  31. group: 'root'
  32. mode: '0644'
  33. notify:
  34. - 'Reload Postfix'
  35. when: with_postfix
  36. tags:
  37. - 'smtp'
  38. - name: 'Update Postfix master config for slowsmtp transport'
  39. blockinfile:
  40. dest: '/etc/postfix/master.cf'
  41. marker: '# ======= {mark} slowsmtp transport (managed by ansible) ======'
  42. content: |
  43. slowsmtp unix - - n - 5 smtp
  44. -o smtp_destination_concurrency_limit=3
  45. -o slowsmtp_destination_rate_delay=1
  46. notify:
  47. - 'Reload Postfix'
  48. when: with_postfix_slowsmtp
  49. tags:
  50. - 'smtp'
  51. - name: 'Install Postfix slowsmtp transport map'
  52. template:
  53. src: 'postfix/transport_slowsmtp.j2'
  54. dest: '/etc/postfix/transport_slowsmtp'
  55. owner: 'root'
  56. group: 'root'
  57. mode: '0644'
  58. notify:
  59. - 'Rehash slowsmtp transport map'
  60. - 'Reload Postfix'
  61. when: with_postfix_slowsmtp
  62. tags:
  63. - 'smtp'
  64. - name: 'Install Postfix SASL sender relay map'
  65. template:
  66. src: 'postfix/sasl_sender_relay.j2'
  67. dest: '/etc/postfix/sasl/sender_relay'
  68. owner: 'root'
  69. group: 'root'
  70. mode: '0600'
  71. notify:
  72. - 'Rehash SASL sender relay map'
  73. - 'Reload Postfix'
  74. when: with_postfix_external_smtp
  75. tags:
  76. - 'smtp'
  77. - name: 'Install Postfix SASL credentials map'
  78. template:
  79. src: 'postfix/sasl_credentials.j2'
  80. dest: '/etc/postfix/sasl/credentials'
  81. owner: 'root'
  82. group: 'root'
  83. mode: '0600'
  84. notify:
  85. - 'Rehash SASL credentials map'
  86. - 'Reload Postfix'
  87. when: with_postfix_external_smtp
  88. tags:
  89. - 'smtp'
  90. - name: 'Install Postfix SASL sender rewrite map'
  91. template:
  92. src: 'postfix/sasl_sender_rewrite.j2'
  93. dest: '/etc/postfix/sasl/sender_rewrite'
  94. owner: 'root'
  95. group: 'root'
  96. mode: '0600'
  97. notify:
  98. - 'Reload Postfix'
  99. when: with_postfix_external_smtp and postfix_external_sender_rewrites
  100. tags:
  101. - 'smtp'
  102. # vim: ft=yaml.ansible