ansible role for debian buster setting up a mailserver with postfix, rspamd, dovecot and clamav and based on PostgreSQL; journal-postfix is a log parser for postfix; Attention: user and domain administration (in PostgreSQL) is not covered here
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

83 lines
1.8 KiB

  1. - name: install postfix packages
  2. apt:
  3. name: postfix,postfix-pgsql,postfix-doc
  4. state: present
  5. update_cache: yes
  6. install_recommends: no
  7. - name: divert /etc/postfix/main.cf
  8. shell: dpkg-divert --add --rename --divert /etc/postfix/main.cf.orig /etc/postfix/main.cf
  9. - name: divert /etc/postfix/master.cf
  10. shell: dpkg-divert --add --rename --divert /etc/postfix/master.cf.orig /etc/postfix/master.cf
  11. - name: group 'mailstore'
  12. group:
  13. name: mailstore
  14. state: present
  15. system: yes
  16. gid: 5000
  17. - name: user 'mailstore'
  18. user:
  19. name: mailstore
  20. group: mailstore
  21. state: present
  22. shell: /usr/sbin/nologin
  23. system: yes
  24. uid: 5000
  25. create_home: no
  26. home: /srv/mailstore
  27. password: '!'
  28. password_lock: yes
  29. comment: created by ansible
  30. - name: directories /srv/mailstore /srv/mailstore/role_specific
  31. file:
  32. path: "{{ item }}"
  33. state: directory
  34. owner: mailstore
  35. group: mailstore
  36. mode: 0755
  37. loop:
  38. - /srv/mailstore
  39. - /srv/mailstore/role_specific
  40. - /srv/mailstore/role_specific/roles
  41. - name: postfix configuration files
  42. template:
  43. src: "postfix/{{ item }}"
  44. dest: "/etc/postfix/{{ item }}"
  45. owner: root
  46. group: root
  47. mode: 0644
  48. force: "{{ mailserver.postfix.overwrite_config }}"
  49. loop:
  50. - main.cf
  51. - master.cf
  52. - header_checks
  53. - name: postfix database queries
  54. template:
  55. src: "postfix/{{ item }}"
  56. dest: "/etc/postfix/{{ item }}"
  57. owner: root
  58. group: root
  59. mode: 0600
  60. force: yes
  61. loop:
  62. - domains.cf
  63. - mailboxes.cf
  64. - aliases.cf
  65. - email_existence_check.cf
  66. - relay_domains.cf
  67. - relay_recipient_maps.cf
  68. - transport_maps.cf
  69. - sender_canonical_maps.cf
  70. - recipient_canonical_maps.cf
  71. - name: restart postfix
  72. systemd:
  73. name: postfix
  74. state: restarted