Преглед изворни кода

Create webmail role that installs Roundcube

Mike Ashley пре 8 година
родитељ
комит
959e893862

+ 5
- 0
roles/webmail/defaults/main.yml Прегледај датотеку

@@ -0,0 +1,5 @@
1
+webmail_version: 1.2.1
2
+
3
+# Keep in sync with mail_server_hostname in mailserver role
4
+webmail_domain: "mail.{{ domain }}"
5
+

+ 1
- 0
roles/webmail/tasks/main.yml Прегледај датотеку

@@ -0,0 +1 @@
1
+- include: roundcube.yml tags=roundcube

+ 69
- 0
roles/webmail/tasks/roundcube.yml Прегледај датотеку

@@ -0,0 +1,69 @@
1
+- name: Determine whether roundcube is configured
2
+  stat: path=/var/www/roundcube/config.inc.php
3
+  register: roundcube_config
4
+
5
+- name: Install roundcube dependencies
6
+  apt: pkg={{ item }} state=present
7
+  with_items:
8
+    - php5
9
+    - php5-sqlite
10
+    - php5-mcrypt
11
+    - php5-gd
12
+    - php5-pspell
13
+    - php5-intl
14
+    - php5-curl
15
+    - aspell
16
+    - aspell-en
17
+  tags:
18
+    - dependencies
19
+
20
+- name: Clone roundcube
21
+  git: repo=https://github.com/roundcube/roundcubemail.git
22
+       dest=/var/www/roundcube
23
+       version={{ webmail_version }}
24
+       update=no
25
+       accept_hostkey=yes
26
+
27
+- name: Get Composer installer
28
+  get_url: url=https://getcomposer.org/installer
29
+           dest=/tmp/composer-installer
30
+
31
+- name: Copy compose configuration
32
+  command: creates="/var/www/roundcube/composer.json" mv /var/www/roundcube/composer.json-dist /var/www/roundcube/composer.json
33
+  
34
+- name: Install Composer
35
+  command: php /tmp/composer-installer
36
+           chdir=/root
37
+           creates=/root/composer.phar
38
+
39
+- name: Initialize composer
40
+  command: php /root/composer.phar install --no-dev
41
+           chdir=/var/www/roundcube
42
+           creates=/var/www/roundcube/vendor/autoload.php
43
+
44
+- name: Remove installer directory
45
+  file: path=/var/www/roundcube/installer state=absent
46
+
47
+- name: Install Roundcube configuration
48
+  template: src=var_www_roundcube_config_config.inc.j2 dest=/var/www/roundcube/config/config.inc.php
49
+
50
+- name: Create db directory
51
+  file: path=/decrypted/roundcube mode=0775 state=directory
52
+
53
+- name: Make logs and temp directories writable by web server
54
+  file: path=/var/www/roundcube/{{ item }} mode=0775 state=directory
55
+  with_items:
56
+    - temp
57
+    - logs
58
+
59
+- name: Make roundcube directory accessible to web server
60
+  file: path=/var/www/roundcube group=www-data recurse=yes state=directory
61
+
62
+- name: Configure Apache for Roundcube
63
+  template: src=etc_apache2_sites-available_roundcube.j2
64
+    dest=/etc/apache2/sites-available/roundcube.conf
65
+    group=root owner=root force=yes
66
+
67
+- name: Enable Roundcube site
68
+  command: a2ensite roundcube.conf creates=/etc/apache2/sites-enabled/roundcube.conf
69
+  notify: restart apache

+ 38
- 0
roles/webmail/templates/etc_apache2_sites-available_roundcube.j2 Прегледај датотеку

@@ -0,0 +1,38 @@
1
+<VirtualHost *:80>
2
+    ServerName {{ webmail_domain }}
3
+
4
+    Redirect permanent / https://{{ webmail_domain }}/
5
+</VirtualHost>
6
+
7
+<VirtualHost *:443>
8
+    ServerName {{ webmail_domain }}
9
+    SSLEngine On
10
+
11
+    DocumentRoot            /var/www/roundcube
12
+    Options                 -Indexes
13
+
14
+    <Directory /var/www/roundcube>
15
+        AllowOverride All
16
+        Require all granted
17
+        DirectoryIndex index.php
18
+    </Directory>
19
+
20
+    <Directory /opt/roundcube/config>
21
+        AllowOverride None
22
+	Require all denied
23
+    </Directory>
24
+
25
+    <Directory /opt/roundcube/temp>
26
+        AllowOverride None
27
+	Require all denied
28
+    </Directory>
29
+
30
+    <Directory /opt/roundcube/logs>
31
+        AllowOverride None
32
+	Require all denied
33
+    </Directory>
34
+
35
+    LogLevel		    warn
36
+    ErrorLog                /var/log/apache2/roundcube.info-error_log
37
+    CustomLog               /var/log/apache2/roundcube.info-access_log common
38
+</VirtualHost>

+ 7
- 7
roles/webmail/templates/var_www_roundcube_config_config.inc.j2 Прегледај датотеку

@@ -25,7 +25,7 @@ $config = array();
25 25
 // For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
26 26
 // NOTE: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
27 27
 //       or (Windows): 'sqlite:///C:/full/path/to/sqlite.db'
28
-$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
28
+$config['db_dsnw'] = 'sqlite:////decrypted/roundcube/sqlite.db?mode=0664';
29 29
 
30 30
 // The mail host chosen to perform the log-in.
31 31
 // Leave blank to show a textbox at login, give a list of hosts
@@ -37,7 +37,7 @@ $config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
37 37
 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
38 38
 // %s - domain name after the '@' from e-mail address provided at login screen
39 39
 // For example %n = mail.domain.tld, %t = domain.tld
40
-$config['default_host'] = 'localhost';
40
+$config['default_host'] = 'ssl://{{ webmail_domain }}:993';
41 41
 
42 42
 // SMTP server host (for sending mails).
43 43
 // To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
@@ -49,19 +49,19 @@ $config['default_host'] = 'localhost';
49 49
 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
50 50
 // %z - IMAP domain (IMAP hostname without the first part)
51 51
 // For example %n = mail.domain.tld, %t = domain.tld
52
-$config['smtp_server'] = '';
52
+$config['smtp_server'] = 'localhost';
53 53
 
54 54
 // SMTP port (default is 25; use 587 for STARTTLS or 465 for the
55 55
 // deprecated SSL over SMTP (aka SMTPS))
56
-$config['smtp_port'] = 25;
56
+$config['smtp_port'] = 465;
57 57
 
58 58
 // SMTP username (if required) if you use %u as the username Roundcube
59 59
 // will use the current username for login
60
-$config['smtp_user'] = '';
60
+$config['smtp_user'] = '%u';
61 61
 
62 62
 // SMTP password (if required) if you use %p as the password Roundcube
63 63
 // will use the current user's password for login
64
-$config['smtp_pass'] = '';
64
+$config['smtp_pass'] = '%p';
65 65
 
66 66
 // provide an URL where a user can get support for this Roundcube installation
67 67
 // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
@@ -74,7 +74,7 @@ $config['product_name'] = 'Roundcube Webmail';
74 74
 // in the session record (and the client cookie if remember password is enabled).
75 75
 // please provide a string of exactly 24 chars.
76 76
 // YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
77
-$config['des_key'] = 'rcmail-!24ByteDESkey*Str';
77
+$config['des_key'] = 'fwef42cna12wefew9fewfmac';
78 78
 
79 79
 // List of active plugins (in plugins/ directory)
80 80
 $config['plugins'] = array(

+ 1
- 0
site.yml Прегледај датотеку

@@ -9,6 +9,7 @@
9 9
   roles:
10 10
     - common
11 11
     - mailserver
12
+    - webmail
12 13
     - blog
13 14
     - ircbouncer
14 15
     - xmpp

Loading…
Откажи
Сачувај