diff --git a/group_vars/all b/group_vars/all index af0df44..489009c 100644 --- a/group_vars/all +++ b/group_vars/all @@ -2,12 +2,14 @@ ispmail_populate_test_data: true ispmail_mysql_mailuser_password: ChangeMe ispmail_mysql_root_password: ChangeMeRoot +ispmail_mysql_roundcube_password: ChangeMeRound ispmail_dovecot_auth_mechanisms: plain login ispmail_postmaster_address: postmaster@example.org -ispmail_webmail_hostname: mail.example.org +#ispmail_webmail_hostname: mail.example.org +ispmail_webmail_hostname: 10.0.0.100 ispmail_certificate_country: DE ispmail_certificate_state: Hamburg @@ -18,5 +20,3 @@ ispmail_certificate_domains: - example.org ispmail_certificate_email: postmaster@example.org ispmail_certificate_days_valid: 3650 - -ispmail_postmaster_address: postmaster@example.org diff --git a/roles/ispmail-database/tasks/main.yml b/roles/ispmail-database/tasks/main.yml index 322677e..4288ceb 100644 --- a/roles/ispmail-database/tasks/main.yml +++ b/roles/ispmail-database/tasks/main.yml @@ -5,6 +5,8 @@ # template: src=root-my-cnf.j2 dest=/root/.my.cnf mode=0600 - name: creating mailserver MySQL database mysql_db: name=mailserver state=present +- name: creating Roundcube MySQL database + mysql_db: name=roundcube state=present - name: copying MySQL database schema to server copy: src=schema.sql dest=/tmp - name: setting up SQL schema of mailserver database @@ -13,9 +15,15 @@ # mysql_user: name=root password={{ispmail_mysql_root_password}} state=present - name: creating MySQL user to read the mailserver database mysql_user: name=mailuser password={{ispmail_mysql_mailuser_password}} priv=mailserver.*:SELECT,INSERT,UPDATE,DELETE state=present +- name: creating MySQL user for roundcube + mysql_user: name=roundcube password={{ispmail_mysql_roundcube_password}} priv=roundcube.*:ALL state=present - name: copying MySQL test data to server copy: src=test.sql dest=/tmp when: ispmail_populate_test_data == true - name: populating the database with test data mysql_db: name=mailserver state=import target=/tmp/test.sql when: ispmail_populate_test_data == true +# - name: set the MySQL root user's password +# mysql_user: name=root password={{ispmail_mysql_root_password}} state=present +# - name: Create root's .my.cnf +# template: src=my-cnf.j2 dest=/root/.my.cnf mode=0600 diff --git a/roles/ispmail-database/templates/my-cnf.j2 b/roles/ispmail-database/templates/my-cnf.j2 new file mode 100644 index 0000000..0615332 --- /dev/null +++ b/roles/ispmail-database/templates/my-cnf.j2 @@ -0,0 +1,2 @@ +[client] +password={{ispmail_mysql_root_password}} diff --git a/roles/ispmail-webmail-apache/tasks/main.yml b/roles/ispmail-webmail-apache/tasks/main.yml index 0f0cc09..8d3bd1a 100644 --- a/roles/ispmail-webmail-apache/tasks/main.yml +++ b/roles/ispmail-webmail-apache/tasks/main.yml @@ -1,16 +1,18 @@ -- name: install required binary packages +- name: Install required binary packages apt: name={{item}} state=installed with_items: - apache2 - libapache2-mod-php5 notify: restart apache -- name: Create Apache vhost configuration for Webmail - template: src=webmail.conf.j2 dest=/etc/apache2/sites-available/webmail.conf +- name: Create Apache vhost configuration for HTTPS (RoundCube and PHPmyadmin) + template: src=webmail.conf-443.j2 dest=/etc/apache2/sites-available/default-ssl.conf notify: restart apache -- name: Enable Apache vhost - command: /usr/sbin/a2ensite webmail.conf creates=/etc/apache2/sites-enabled/webmail.conf +- name: Enable Apache vhost for HTTPS + command: /usr/sbin/a2ensite default-ssl creates=/etc/apache2/sites-enabled/default-ssl.conf notify: restart apache -- name: Enabling Apache SSL module +- name: Create Apache vhost configuration for HTTP (redirect to HTTPS) + template: src=webmail.conf-80.j2 dest=/etc/apache2/sites-available/000-default.conf + notify: restart apache +- name: Enable Apache SSL module command: /usr/sbin/a2enmod ssl creates=/etc/apache2/mods-enabled/ssl.conf notify: restart apache - diff --git a/roles/ispmail-webmail-apache/templates/webmail.conf.j2 b/roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 similarity index 98% rename from roles/ispmail-webmail-apache/templates/webmail.conf.j2 rename to roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 index 9aa7cd1..6019705 100644 --- a/roles/ispmail-webmail-apache/templates/webmail.conf.j2 +++ b/roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 @@ -1,11 +1,10 @@ - ServerAdmin webmaster@localhost + ServerAdmin {{ ispmail_postmaster_address }} ServerName {{ ispmail_webmail_hostname }} - #DocumentRoot /var/www/html Include /etc/roundcube/apache.conf - Alias /roundcube /var/lib/roundcube + Alias / /var/lib/roundcube/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. diff --git a/roles/ispmail-webmail-apache/templates/webmail.conf-80.j2 b/roles/ispmail-webmail-apache/templates/webmail.conf-80.j2 new file mode 100644 index 0000000..59589bc --- /dev/null +++ b/roles/ispmail-webmail-apache/templates/webmail.conf-80.j2 @@ -0,0 +1,6 @@ + + ServerAdmin {{ ispmail_postmaster_address }} + ServerName {{ ispmail_webmail_hostname }} + + Redirect permanent / https://{{ ispmail_webmail_hostname}}/ + diff --git a/roles/ispmail-webmail/tasks/main.yml b/roles/ispmail-webmail/tasks/main.yml index 16c3cb1..277c942 100644 --- a/roles/ispmail-webmail/tasks/main.yml +++ b/roles/ispmail-webmail/tasks/main.yml @@ -17,4 +17,5 @@ template: src=roundcube-password-config.inc.php.j2 dest=/etc/roundcube/plugins/password/config.inc.php owner=root group=www-data mode=640 - name: Copy ISPmail logo copy: src=ispmail-logo.png dest=/var/lib/roundcube/ - +- name: Copy Roundcube database config file + template: src=roundcube-debian-db.php.j2 dest=/etc/roundcube/debian-db.php mode=0640 diff --git a/roles/ispmail-webmail/templates/roundcube-debian-db.php.j2 b/roles/ispmail-webmail/templates/roundcube-debian-db.php.j2 new file mode 100644 index 0000000..5214684 --- /dev/null +++ b/roles/ispmail-webmail/templates/roundcube-debian-db.php.j2 @@ -0,0 +1,8 @@ +