| @@ -3,15 +3,6 @@ | |||||
| # apt: name=python-mysqldb | # apt: name=python-mysqldb | ||||
| apt: name=python-pymysql | apt: name=python-pymysql | ||||
| # - name: Set root user password | |||||
| # become: true | |||||
| # # If .my.cnf already exists, this will cause an mysql-root-password update. | |||||
| # mysql_user: | |||||
| # name: root | |||||
| # password: "{{ ispmail_mysql_root_password}}" | |||||
| # login_unix_socket: /var/run/mysqld/mysqld.sock | |||||
| # check_implicit_admin: true | |||||
| - name: Set a new root password | - name: Set a new root password | ||||
| mysql_user: | mysql_user: | ||||
| check_implicit_admin: yes | check_implicit_admin: yes | ||||
| @@ -37,24 +28,35 @@ | |||||
| name: mailserver | name: mailserver | ||||
| - name: creating Roundcube MySQL database | - name: creating Roundcube MySQL database | ||||
| mysql_db: name=roundcube | |||||
| mysql_db: | |||||
| name: roundcube | |||||
| - name: copying MySQL database schema to server | - name: copying MySQL database schema to server | ||||
| copy: src=schema.sql dest=/tmp | |||||
| copy: | |||||
| src: schema.sql | |||||
| dest: /tmp | |||||
| - name: setting up SQL schema of mailserver database | - name: setting up SQL schema of mailserver database | ||||
| mysql_db: name=mailserver state=import target=/tmp/schema.sql | |||||
| # - name: set the MySQL root user's password | |||||
| # mysql_user: name=root password={{ispmail_mysql_root_password}} | |||||
| mysql_db: | |||||
| name: mailserver | |||||
| state: import | |||||
| target: /tmp/schema.sql | |||||
| - name: creating MySQL user to read the mailserver database | - name: creating MySQL user to read the mailserver database | ||||
| mysql_user: name=mailuser password={{ispmail_mysql_mailuser_password}} priv=mailserver.*:SELECT,INSERT,UPDATE,DELETE | |||||
| mysql_user: | |||||
| name: mailuser | |||||
| password: "{{ispmail_mysql_mailuser_password}}" | |||||
| priv: mailserver.*:SELECT,INSERT,UPDATE,DELETE | |||||
| - name: creating MySQL user for roundcube | - name: creating MySQL user for roundcube | ||||
| mysql_user: name=roundcube password={{ispmail_mysql_roundcube_password}} priv=roundcube.*:ALL | |||||
| mysql_user: | |||||
| name: roundcube | |||||
| password: "{{ispmail_mysql_roundcube_password}}" | |||||
| priv: roundcube.*:ALL | |||||
| - name: copying MySQL test data to server | - name: copying MySQL test data to server | ||||
| copy: src=test.sql dest=/tmp | |||||
| copy: | |||||
| src: test.sql | |||||
| dest: /tmp | |||||
| when: ispmail_populate_test_data == true | when: ispmail_populate_test_data == true | ||||
| - name: populating the database with test data | - name: populating the database with test data | ||||
| mysql_db: name=mailserver state=import target=/tmp/test.sql | |||||
| mysql_db: | |||||
| name: mailserver | |||||
| state: import | |||||
| target: /tmp/test.sql | |||||
| when: ispmail_populate_test_data == true | when: ispmail_populate_test_data == true | ||||
| # - name: set the MySQL root user's password | |||||
| # mysql_user: name=root password={{ispmail_mysql_root_password}} | |||||
| # - name: Create root's .my.cnf | |||||
| # template: src=my-cnf.j2 dest=/root/.my.cnf mode=0600 | |||||
| @@ -4,4 +4,3 @@ | |||||
| - name: restart spamassassin | - name: restart spamassassin | ||||
| service: name=spamassassin state=restarted | service: name=spamassassin state=restarted | ||||
| @@ -1,34 +1,49 @@ | |||||
| --- | --- | ||||
| - name: define Postfix virtual mailbox domain mapping | - name: define Postfix virtual mailbox domain mapping | ||||
| template: src=mysql-virtual-mailbox-domains.cf.j2 dest=/etc/postfix/mysql-virtual-mailbox-domains.cf | |||||
| template: | |||||
| src: "{{item}}.j2" | |||||
| dest: "/etc/postfix/{{item}}" | |||||
| mode: 0640 | |||||
| notify: restart postfix | notify: restart postfix | ||||
| - name: tell Postfix to use the virtual mailbox domain mapping | |||||
| command: postconf virtual_mailbox_domains=mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf | |||||
| - name: define Postfix virtual mailbox mapping | |||||
| template: src=mysql-virtual-mailbox-maps.cf.j2 dest=/etc/postfix/mysql-virtual-mailbox-maps.cf | |||||
| notify: restart postfix | |||||
| - name: tell Postfix to use the virtual mailbox mapping | |||||
| command: postconf virtual_mailbox_maps=mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf | |||||
| - name: define Postfix virtual alias mapping | |||||
| template: src=mysql-virtual-alias-maps.cf.j2 dest=/etc/postfix/mysql-virtual-alias-maps.cf | |||||
| notify: restart postfix | |||||
| - name: tell Postfix to use the virtual alias mapping | |||||
| command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf | |||||
| - name: define Postfix email-to-email mapping (required for catchall domains) | |||||
| template: src=mysql-email2email.cf.j2 dest=/etc/postfix/mysql-email2email.cf | |||||
| notify: restart postfix | |||||
| - name: tell Postfix to use the email-to-email mapping | |||||
| command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf | |||||
| - name: Restricting access to database mapping files that contain a password | |||||
| file: path=/etc/postfix/mysql-{{item}}.cf mode=0640 | |||||
| with_items: | with_items: | ||||
| - virtual-mailbox-domains | |||||
| - virtual-mailbox-maps | |||||
| - virtual-alias-maps | |||||
| - mysql-virtual-mailbox-domains.cf | |||||
| - mysql-virtual-mailbox-maps.cf | |||||
| - mysql-virtual-alias-maps.cf | |||||
| - mysql-email2email.cf | |||||
| - name: copy master.cf to enable submission service | |||||
| copy: | |||||
| src: master.cf | |||||
| dest: /etc/postfix/master.cf | |||||
| mode: 0644 | |||||
| # - name: tell Postfix to use the virtual mailbox domain mapping | |||||
| # command: postconf virtual_mailbox_domains=mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf | |||||
| # - name: define Postfix virtual mailbox mapping | |||||
| # template: src=mysql-virtual-mailbox-maps.cf.j2 dest=/etc/postfix/mysql-virtual-mailbox-maps.cf | |||||
| # notify: restart postfix | |||||
| # - name: tell Postfix to use the virtual mailbox mapping | |||||
| # command: postconf virtual_mailbox_maps=mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf | |||||
| # - name: define Postfix virtual alias mapping | |||||
| # template: src=mysql-virtual-alias-maps.cf.j2 dest=/etc/postfix/mysql-virtual-alias-maps.cf | |||||
| # notify: restart postfix | |||||
| # - name: tell Postfix to use the virtual alias mapping | |||||
| # command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf | |||||
| # - name: define Postfix email-to-email mapping (required for catchall domains) | |||||
| # template: src=mysql-email2email.cf.j2 dest=/etc/postfix/mysql-email2email.cf | |||||
| # notify: restart postfix | |||||
| # - name: tell Postfix to use the email-to-email mapping | |||||
| # command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf | |||||
| # - name: Restricting access to database mapping files that contain a password | |||||
| # file: path=/etc/postfix/mysql-{{item}}.cf mode=0640 | |||||
| # with_items: | |||||
| # - virtual-mailbox-domains | |||||
| # - virtual-mailbox-maps | |||||
| # - virtual-alias-maps | |||||
| - name: Make Postfix use LMTP to send emails to Dovecot | - name: Make Postfix use LMTP to send emails to Dovecot | ||||
| command: postconf virtual_transport=lmtp:unix:private/dovecot-lmtp | command: postconf virtual_transport=lmtp:unix:private/dovecot-lmtp | ||||
| @@ -1,21 +1,40 @@ | |||||
| --- | --- | ||||
| - name: adding Jessie backports repository (for Roundcube) | |||||
| apt_repository: repo='deb http://http.debian.net/debian jessie-backports main' state=present | |||||
| - name: install required binary packages | - name: install required binary packages | ||||
| apt: name={{item}} state=installed | |||||
| with_items: | |||||
| - roundcube | |||||
| - roundcube-plugins | |||||
| apt: | |||||
| name: "{{ packages }}" | |||||
| update_cache: yes | |||||
| vars: | |||||
| packages: | |||||
| - roundcube | |||||
| - roundcube-plugins | |||||
| - name: Creating random des_key for Roundcube | - name: Creating random des_key for Roundcube | ||||
| shell: pwgen 24 | shell: pwgen 24 | ||||
| register: roundcube_random_des_key | register: roundcube_random_des_key | ||||
| - name: Deploying Roundcube configuration | - name: Deploying Roundcube configuration | ||||
| template: src=roundcube-config.inc.php.j2 dest=/etc/roundcube/config.inc.php owner=root group=www-data mode=640 | |||||
| template: | |||||
| src: roundcube-config.inc.php.j2 | |||||
| dest: /etc/roundcube/config.inc.php | |||||
| owner: root | |||||
| group: www-data | |||||
| mode: 0640 | |||||
| - name: Deploying Roundcube managesieve plugin configuration | - name: Deploying Roundcube managesieve plugin configuration | ||||
| copy: src=roundcube-managesieve-config.inc.php dest=/etc/roundcube/plugins/managesieve/config.inc.php mode=0640 | |||||
| copy: | |||||
| src: roundcube-managesieve-config.inc.php | |||||
| dest: /etc/roundcube/plugins/managesieve/config.inc.php | |||||
| mode: 0640 | |||||
| - name: Deploying Roundcube password plugin configuration | - name: Deploying Roundcube password plugin configuration | ||||
| template: src=roundcube-password-config.inc.php.j2 dest=/etc/roundcube/plugins/password/config.inc.php owner=root group=www-data mode=640 | |||||
| template: | |||||
| src: roundcube-password-config.inc.php.j2 | |||||
| dest: /etc/roundcube/plugins/password/config.inc.php | |||||
| owner: root | |||||
| group: www-data | |||||
| mode: 0640 | |||||
| - name: Copy ISPmail logo | - name: Copy ISPmail logo | ||||
| copy: src=ispmail-logo.png dest=/var/lib/roundcube/ | |||||
| copy: | |||||
| src: ispmail-logo.png | |||||
| dest: /var/lib/roundcube/ | |||||
| - name: Copy Roundcube database config file | - name: Copy Roundcube database config file | ||||
| template: src=roundcube-debian-db.php.j2 dest=/etc/roundcube/debian-db.php mode=0640 | |||||
| template: | |||||
| src: roundcube-debian-db.php.j2 | |||||
| dest: /etc/roundcube/debian-db.php | |||||
| mode: 0640 | |||||