Browse Source

Merge branch 'master' of bitbucket.org:signum/ansible-ispmail-jessie

merge-requests/1/merge
Christoph Haas 10 years ago
parent
commit
1249682a17
8 changed files with 40 additions and 14 deletions
  1. +3
    -3
      group_vars/all
  2. +8
    -0
      roles/ispmail-database/tasks/main.yml
  3. +2
    -0
      roles/ispmail-database/templates/my-cnf.j2
  4. +9
    -7
      roles/ispmail-webmail-apache/tasks/main.yml
  5. +2
    -3
      roles/ispmail-webmail-apache/templates/webmail.conf-443.j2
  6. +6
    -0
      roles/ispmail-webmail-apache/templates/webmail.conf-80.j2
  7. +2
    -1
      roles/ispmail-webmail/tasks/main.yml
  8. +8
    -0
      roles/ispmail-webmail/templates/roundcube-debian-db.php.j2

+ 3
- 3
group_vars/all View File

@@ -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

+ 8
- 0
roles/ispmail-database/tasks/main.yml View File

@@ -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

+ 2
- 0
roles/ispmail-database/templates/my-cnf.j2 View File

@@ -0,0 +1,2 @@
[client]
password={{ispmail_mysql_root_password}}

+ 9
- 7
roles/ispmail-webmail-apache/tasks/main.yml View File

@@ -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


roles/ispmail-webmail-apache/templates/webmail.conf.j2 → roles/ispmail-webmail-apache/templates/webmail.conf-443.j2 View File

@@ -1,11 +1,10 @@
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
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.

+ 6
- 0
roles/ispmail-webmail-apache/templates/webmail.conf-80.j2 View File

@@ -0,0 +1,6 @@
<VirtualHost *:80>
ServerAdmin {{ ispmail_postmaster_address }}
ServerName {{ ispmail_webmail_hostname }}

Redirect permanent / https://{{ ispmail_webmail_hostname}}/
</VirtualHost>

+ 2
- 1
roles/ispmail-webmail/tasks/main.yml View File

@@ -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

+ 8
- 0
roles/ispmail-webmail/templates/roundcube-debian-db.php.j2 View File

@@ -0,0 +1,8 @@
<?php
$dbuser='roundcube';
$dbpass='{{ispmail_mysql_roundcube_password}}';
$basepath='';
$dbname='roundcube';
$dbserver='';
$dbport='';
$dbtype='mysql';

Loading…
Cancel
Save