1234567891011121314151617181920212223242526272829303132333435363738 |
- - name: Install Postfix and related packages
- apt: pkg={{ item }} state=installed
- with_items:
- - postfix
- - mysql-server
- - postfix-mysql
- - python-mysqldb
- - libsasl2-modules
- - sasl2-bin
- - postgrey
-
- - name: Create database user for mail server
- mysql_user: user={{ mail_mysql_username }} password={{ mail_mysql_password }} state=present priv="mailserver.*:ALL"
- notify: import mysql postfix
-
- - name: Create database for mail server
- mysql_db: name={{ mail_mysql_database }} state=present
- notify: import mysql postfix
-
- - name: Copy import.sql
- template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
- notify: import mysql postfix
-
- - 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:
- - mysql-virtual-mailbox-domains.cf
- - mysql-virtual-mailbox-maps.cf
- - mysql-virtual-alias-maps.cf
- notify: restart postfix
|