Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

postfix.yml 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. - name: Install Postgres 9.3 on Ubuntu Trusty
  2. apt: pkg=postgresql-9.3 state=present
  3. when: ansible_distribution_release == 'trusty'
  4. tags:
  5. - dependencies
  6. - name: Install Postgres 9.4 on Debian Jessie
  7. apt: pkg=postgresql-9.4 state=present
  8. when: ansible_distribution_release == 'jessie'
  9. tags:
  10. - dependencies
  11. - name: Install Postfix and related packages
  12. apt: pkg={{ item }} state=installed
  13. with_items:
  14. - libsasl2-modules
  15. - postfix
  16. - postfix-pcre
  17. - postfix-pgsql
  18. - postgrey
  19. - python-psycopg2
  20. - sasl2-bin
  21. tags:
  22. - dependencies
  23. - name: Set postgres password
  24. command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with password '{{ db_admin_password }}';"
  25. notify: import sql postfix
  26. - name: Create database user for mail server
  27. postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ mail_db_username }} password="{{ mail_db_password }}" state=present
  28. notify: import sql postfix
  29. - name: Create database for mail server
  30. 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 }}
  31. notify: import sql postfix
  32. - name: Copy import.sql
  33. template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
  34. notify: import sql postfix
  35. - name: Create postfix maps directory
  36. file: path=/etc/postfix/maps state=directory owner=root group=root
  37. when: mail_header_privacy == 1
  38. - name: Copy smtp_header_checks.pcre
  39. copy: src=etc_postfix_maps_smtp_header_checks.pcre dest=/etc/postfix/maps/smtp_header_checks.pcre owner=root group=root
  40. when: mail_header_privacy == 1
  41. - name: Copy main.cf
  42. template: src=etc_postfix_main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root
  43. notify: restart postfix
  44. - name: Copy master.cf
  45. copy: src=etc_postfix_master.cf dest=/etc/postfix/master.cf owner=root group=root
  46. notify: restart postfix
  47. - name: Copy additional postfix configuration files
  48. template: src=etc_postfix_{{ item }}.j2 dest=/etc/postfix/{{ item }} owner=root group=root
  49. with_items:
  50. - pgsql-virtual-alias-maps.cf
  51. - pgsql-virtual-mailbox-domains.cf
  52. - pgsql-virtual-mailbox-maps.cf
  53. notify: restart postfix
  54. - name: Set firewall rules for postfix
  55. ufw: rule=allow port={{ item }} proto=tcp
  56. with_items:
  57. - smtp
  58. - ssmtp