smtp.yml 2.5 KB

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