Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

postfix.yml 2.5KB

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