From 77b8a807535eb112066bf0ff0dcba7950afafaed Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Tue, 24 Oct 2017 17:00:44 +0200 Subject: [PATCH] Add roundcube role --- packmail/tasks/main.yml | 3 ++ webapps/roundcube/defaults/main.yml | 2 + webapps/roundcube/tasks/main.yml | 43 +++++++++++++++++++++ webapps/roundcube/templates/apache2.conf.j2 | 41 ++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 webapps/roundcube/defaults/main.yml create mode 100644 webapps/roundcube/tasks/main.yml create mode 100644 webapps/roundcube/templates/apache2.conf.j2 diff --git a/packmail/tasks/main.yml b/packmail/tasks/main.yml index 214d8d77..36d23365 100644 --- a/packmail/tasks/main.yml +++ b/packmail/tasks/main.yml @@ -29,3 +29,6 @@ vars: evoadminmail_enable_vhost: '{{ packmail_enable_evoadmin_vhost }}' +- name: Install Roundcube + include_role: + name: webapps/roundcube diff --git a/webapps/roundcube/defaults/main.yml b/webapps/roundcube/defaults/main.yml new file mode 100644 index 00000000..220720e3 --- /dev/null +++ b/webapps/roundcube/defaults/main.yml @@ -0,0 +1,2 @@ +--- +roundcube_host: "roundcube.{{ ansible_fqdn }}" diff --git a/webapps/roundcube/tasks/main.yml b/webapps/roundcube/tasks/main.yml new file mode 100644 index 00000000..4832043e --- /dev/null +++ b/webapps/roundcube/tasks/main.yml @@ -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 diff --git a/webapps/roundcube/templates/apache2.conf.j2 b/webapps/roundcube/templates/apache2.conf.j2 new file mode 100644 index 00000000..23868992 --- /dev/null +++ b/webapps/roundcube/templates/apache2.conf.j2 @@ -0,0 +1,41 @@ + + ServerName {{ roundcube_host }} + Redirect permanent / https://{{ roundcube_host }} + + + + + # 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" + +