Add roundcube role

This commit is contained in:
Victor LABORIE 2017-10-24 17:00:44 +02:00
parent 71f64d2c24
commit 77b8a80753
4 changed files with 89 additions and 0 deletions

View file

@ -29,3 +29,6 @@
vars:
evoadminmail_enable_vhost: '{{ packmail_enable_evoadmin_vhost }}'
- name: Install Roundcube
include_role:
name: webapps/roundcube

View file

@ -0,0 +1,2 @@
---
roundcube_host: "roundcube.{{ ansible_fqdn }}"

View file

@ -0,0 +1,43 @@
---
- name: configure roundcube-core
debconf:
name: roundcube-core
question: "{{ item.key }}"
value: "{{ item.value }}"
vtype: "{{ item.type }}"
with_items:
- { key: 'roundcube/dbconfig-reinstall', type: 'boolean', value: 'true' }
- { key: 'roundcube/language', type: 'select', value: 'fr_FR' }
- { key: 'roundcube/hosts', type: 'string', value: '127.0.0.1' }
- { key: 'roundcube/database-type', type: 'select', value: 'sqlite3' }
- { key: 'roundcube/db/basepath', type: 'string', value: '/var/lib/roundcube/' }
tags:
- roundcube
- name: install Roundcube
apt:
name: "{{ item }}"
state: present
with_items:
- roundcube
- roundcube-sqlite3
tags:
- roundcube
- name: deploy roundcube vhost
template:
src: apache2.conf.j2
dest: /etc/apache2/sites-available/rouncube.conf
mode: "0640"
notify: reload apache2
tags:
- roundcube
- name: enable roundcube vhost
file:
src: /etc/apache2/sites-available/rouncube.conf
dest: /etc/apache2/sites-enabled/rouncube.conf
state: link
notify: reload apache2
tags:
- roundcube

View file

@ -0,0 +1,41 @@
<VirtualHost *:80>
ServerName {{ roundcube_host }}
Redirect permanent / https://{{ roundcube_host }}
</VirtualHost>
<VirtualHost *:443>
# FQDN principal
ServerName {{ roundcube_host }}
# Repertoire principal
DocumentRoot /var/lib/roundcube/
Include /etc/roundcube/apache.conf
# LOG
CustomLog /var/log/apache2/access.log vhost_combined
CustomLog /var/lib/roundcube/logs/access.log combined
ErrorLog /var/lib/roundcube/logs/error.log
# REWRITE
UseCanonicalName On
RewriteEngine On
RewriteCond %{HTTP_HOST} !^{{ roundcube_host }}$
RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [L,R]
# PHP
#php_admin_flag engine off
#AddType text/html .html
#php_admin_flag display_errors On
#php_flag short_open_tag On
#php_flag register_globals On
#php_admin_value memory_limit 256M
#php_admin_value max_execution_time 60
#php_admin_value upload_max_filesize 8M
#php_admin_flag allow_url_fopen Off
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f www-roundcube"
php_admin_value error_log "/home/roundcube/log/php.log"
#php_admin_value open_basedir "/usr/share/php:/home/roundcube:/tmp"
</VirtualHost>