No Description
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.

postfix.yml 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. - name: Install Postfix and related packages
  2. apt: pkg={{ item }} state=present
  3. with_items:
  4. - libsasl2-modules
  5. - postfix
  6. - postfix-pcre
  7. - postfix-pgsql
  8. - postgrey
  9. - python-psycopg2
  10. - sasl2-bin
  11. tags:
  12. - dependencies
  13. - name: Create database user for mail server
  14. postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ mail_db_username }} password="{{ mail_db_password }}" encrypted=yes state=present
  15. notify: import sql postfix
  16. - name: Create database for mail server
  17. postgresql_db: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ mail_db_database }} state=present owner={{ mail_db_username }}
  18. notify: import sql postfix
  19. - name: Copy import.sql
  20. template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
  21. notify: import sql postfix
  22. - name: Create postfix maps directory
  23. file: path=/etc/postfix/maps state=directory owner=root group=root
  24. when: mail_header_privacy == 1
  25. - name: Copy smtp_header_checks.pcre
  26. copy: src=etc_postfix_maps_smtp_header_checks.pcre dest=/etc/postfix/maps/smtp_header_checks.pcre owner=root group=root
  27. when: mail_header_privacy == 1
  28. - name: Copy main.cf
  29. template: src=etc_postfix_main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root
  30. notify: restart postfix
  31. - name: Copy master.cf
  32. copy: src=etc_postfix_master.cf dest=/etc/postfix/master.cf owner=root group=root
  33. notify: restart postfix
  34. - name: Copy additional postfix configuration files
  35. template: src=etc_postfix_{{ item }}.j2 dest=/etc/postfix/{{ item }} owner=root group=root
  36. with_items:
  37. - pgsql-virtual-alias-maps.cf
  38. - pgsql-virtual-mailbox-domains.cf
  39. - pgsql-virtual-mailbox-maps.cf
  40. notify: restart postfix
  41. - name: Set firewall rules for postfix
  42. ufw: rule=allow port={{ item }} proto=tcp
  43. with_items:
  44. - smtp
  45. - ssmtp
  46. - submission
  47. tags: ufw