diff --git a/ansible/group_vars/all b/ansible/group_vars/all index 8c03e31..9100a67 100644 --- a/ansible/group_vars/all +++ b/ansible/group_vars/all @@ -9,7 +9,10 @@ ispmail_mysql_mailuser_password: ChangeMe ispmail_mysql_root_password: ChangeMeRoot # MySQL password for storing Roundcube configuration -ispmail_mysql_roundcube_password: ChangeMeRound +#ispmail_mysql_roundcube_password: ChangeMeRound + +# MySQL password for storing Horde webmail user configuration +ispmail_mysql_horde_password: ChangeMeHorde # Allowed authentication mechanisms for IMAP/POP3 # See: https://wiki2.dovecot.org/Authentication/Mechanisms diff --git a/ansible/ispmail.yml b/ansible/ispmail.yml index 0743d5f..aa961eb 100644 --- a/ansible/ispmail.yml +++ b/ansible/ispmail.yml @@ -19,5 +19,5 @@ # - ispmail-postfix # - ispmail-dovecot # - ispmail-webmail -# - ispmail-webmail-apache + - ispmail-webmail-apache-horde - ispmail-tests diff --git a/ansible/roles/ispmail-database/tasks/main.yml b/ansible/roles/ispmail-database/tasks/main.yml index 2b30304..626a231 100644 --- a/ansible/roles/ispmail-database/tasks/main.yml +++ b/ansible/roles/ispmail-database/tasks/main.yml @@ -27,9 +27,9 @@ mysql_db: name: mailserver -- name: creating Roundcube MySQL database - mysql_db: - name: roundcube +# - name: creating Roundcube MySQL database +# mysql_db: +# name: roundcube - name: copying MySQL database schema to server copy: src: schema.sql @@ -44,11 +44,11 @@ name: mailuser password: "{{ispmail_mysql_mailuser_password}}" priv: mailserver.*:SELECT,INSERT,UPDATE,DELETE -- name: creating MySQL user for roundcube - mysql_user: - name: roundcube - password: "{{ispmail_mysql_roundcube_password}}" - priv: roundcube.*:ALL +# - name: creating MySQL user for roundcube +# mysql_user: +# name: roundcube +# password: "{{ispmail_mysql_roundcube_password}}" +# priv: roundcube.*:ALL - name: copying MySQL test data to server copy: src: test.sql diff --git a/ansible/roles/ispmail-packages/tasks/main.yml b/ansible/roles/ispmail-packages/tasks/main.yml index b3d0ed6..fcf29ad 100644 --- a/ansible/roles/ispmail-packages/tasks/main.yml +++ b/ansible/roles/ispmail-packages/tasks/main.yml @@ -6,14 +6,15 @@ vars: packages: - etckeeper + - certbot - pwgen - mariadb-server - postfix - postfix-mysql - - roundcube - - roundcube-mysql - - roundcube-plugins - - roundcube-plugins-extra + # - roundcube + # - roundcube-mysql + # - roundcube-plugins + # - roundcube-plugins-extra - swaks - dovecot-mysql - dovecot-pop3d diff --git a/ansible/roles/ispmail-postfix/tasks/main.yml b/ansible/roles/ispmail-postfix/tasks/main.yml index 313f85e..2e27a47 100644 --- a/ansible/roles/ispmail-postfix/tasks/main.yml +++ b/ansible/roles/ispmail-postfix/tasks/main.yml @@ -16,6 +16,7 @@ src: master.cf dest: /etc/postfix/master.cf mode: 0644 + 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 diff --git a/ansible/roles/ispmail-webmail-apache/handlers/main.yml b/ansible/roles/ispmail-webmail-apache-horde/handlers/main.yml similarity index 100% rename from ansible/roles/ispmail-webmail-apache/handlers/main.yml rename to ansible/roles/ispmail-webmail-apache-horde/handlers/main.yml diff --git a/ansible/roles/ispmail-webmail-apache-horde/tasks/main.yml b/ansible/roles/ispmail-webmail-apache-horde/tasks/main.yml new file mode 100644 index 0000000..73a3fe8 --- /dev/null +++ b/ansible/roles/ispmail-webmail-apache-horde/tasks/main.yml @@ -0,0 +1,44 @@ +- name: Install required binary packages + apt: name={{item}} state=installed + with_items: + - apache2 + - libapache2-mod-php + notify: restart apache +- name: Create Apache vhost configuration for HTTPS (Horde and Adminer) + template: + src: apache/webmail.conf-443.j2 + dest: /etc/apache2/sites-available/default-ssl.conf + notify: restart apache +- name: Enable Apache vhost for HTTPS + command: /usr/sbin/a2ensite default-ssl creates=/etc/apache2/sites-enabled/default-ssl.conf + notify: restart apache +- name: Create Apache vhost configuration for HTTP (redirect to HTTPS) + template: + src: apache/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 + +- name: creating Horde MySQL database + mysql_db: + name: horde +- name: creating MySQL user to access the Horde database + mysql_user: + name: horde + password: "{{ispmail_mysql_horde_password}}" + priv: horde.*:ALL + +- name: Generate random secret key for this Horde installation + command: pwgen -s 20 + register: horde_secret_key +- name: Generate Horde config file + template: + src: horde/conf.php.j2 + dest: /etc/horde/horde/conf.php + +- name: Create Horde database schema + command: /usr/bin/horde-db-migrate + +# code: language=ansible insertSpaces=true tabSize=2 diff --git a/ansible/roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 b/ansible/roles/ispmail-webmail-apache-horde/templates/apache/webmail.conf-443.j2 similarity index 98% rename from ansible/roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 rename to ansible/roles/ispmail-webmail-apache-horde/templates/apache/webmail.conf-443.j2 index 6019705..497fd86 100644 --- a/ansible/roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 +++ b/ansible/roles/ispmail-webmail-apache-horde/templates/apache/webmail.conf-443.j2 @@ -3,15 +3,14 @@ ServerAdmin {{ ispmail_postmaster_address }} ServerName {{ ispmail_webmail_hostname }} - Include /etc/roundcube/apache.conf - Alias / /var/lib/roundcube/ - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn + RedirectMatch permanent ^/$ https://{{ ispmail_webmail_hostname}}/horde/ + ErrorLog ${APACHE_LOG_DIR}/webmail.error.log CustomLog ${APACHE_LOG_DIR}/webmail.access.log combined diff --git a/ansible/roles/ispmail-webmail-apache/templates/webmail.conf-80.j2 b/ansible/roles/ispmail-webmail-apache-horde/templates/apache/webmail.conf-80.j2 similarity index 100% rename from ansible/roles/ispmail-webmail-apache/templates/webmail.conf-80.j2 rename to ansible/roles/ispmail-webmail-apache-horde/templates/apache/webmail.conf-80.j2 diff --git a/ansible/roles/ispmail-webmail-apache-horde/templates/horde/conf.php.j2 b/ansible/roles/ispmail-webmail-apache-horde/templates/horde/conf.php.j2 new file mode 100644 index 0000000..63d53a1 --- /dev/null +++ b/ansible/roles/ispmail-webmail-apache-horde/templates/horde/conf.php.j2 @@ -0,0 +1,126 @@ +