123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- - name: Install Postfix and related packages
- apt: pkg={{ item }} state=installed
- with_items:
- - postfix
- - libsasl2-modules
- - sasl2-bin
- - postgrey
- - postgresql-9.1
- - postfix-pgsql
- - python-psycopg2
- - postfix-pcre
-
- - name: Set postgres password
- command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with password '{{ db_admin_password }}';"
- notify: import sql postfix
-
- - name: Create database user for mail server
- 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
- notify: import sql postfix
-
- - name: Create database for mail server
- 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 }}
- notify: import sql postfix
-
- - name: Copy import.sql
- template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
- notify: import sql postfix
-
- - name: Create postfix maps directory
- file: path=/etc/postfix/maps state=directory owner=root group=root
- when: mail_header_privacy == 1
-
- - name: Copy smtp_header_checks.pcre
- copy: src=etc_postfix_maps_smtp_header_checks.pcre dest=/etc/postfix/maps/smtp_header_checks.pcre owner=root group=root
- when: mail_header_privacy == 1
-
- - name: Copy main.cf
- template: src=etc_postfix_main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root
- notify: restart postfix
-
- - name: Copy master.cf
- copy: src=etc_postfix_master.cf dest=/etc/postfix/master.cf owner=root group=root
- notify: restart postfix
-
- - name: Copy additional postfix configuration files
- template: src=etc_postfix_{{ item }}.j2 dest=/etc/postfix/{{ item }} owner=root group=root
- with_items:
- - pgsql-virtual-mailbox-domains.cf
- - pgsql-virtual-mailbox-maps.cf
- - pgsql-virtual-alias-maps.cf
- notify: restart postfix
|