From a86577d5c1280cf74fc8b36ea1e723dc7d07d372 Mon Sep 17 00:00:00 2001 From: VC Date: Sun, 9 Mar 2025 13:41:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB:=20move=20roundcube=20app=20dir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/vhosts/mail.libertus.eu.conf.j2 | 2 +- roles/roundcube/tasks/roundcube.yml | 17 +++++++++-------- roles/roundcube/tasks/roundcube_carddav.yml | 9 +++++++-- roles/roundcube/vars/main.yml | 10 ++++++++-- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/roles/nginx/templates/vhosts/mail.libertus.eu.conf.j2 b/roles/nginx/templates/vhosts/mail.libertus.eu.conf.j2 index 7fd011b..a2e5d1e 100644 --- a/roles/nginx/templates/vhosts/mail.libertus.eu.conf.j2 +++ b/roles/nginx/templates/vhosts/mail.libertus.eu.conf.j2 @@ -1,6 +1,6 @@ server { {% include './templates/header.conf.j2' %} - root /srv/http/mail.libertus.eu/; + root /var/www/mail.libertus.eu/; index index.html index.htm index.php; client_max_body_size 512M; diff --git a/roles/roundcube/tasks/roundcube.yml b/roles/roundcube/tasks/roundcube.yml index c36099a..d5db54a 100644 --- a/roles/roundcube/tasks/roundcube.yml +++ b/roles/roundcube/tasks/roundcube.yml @@ -1,9 +1,14 @@ --- +## Remove previous app & install new version +- name: Remove roundcube previous version + ansible.builtin.file: + state: absent + dest: "{{ roundcube_app_home }}" - name: Create application directory ansible.builtin.file: state: directory - dest: "{{ roundcube_home }}" + dest: "{{ roundcube_app_home }}" owner: "root" group: "www-data" mode: "0o750" @@ -12,13 +17,11 @@ ansible.builtin.unarchive: remote_src: true src: "{{ roundcube_url }}" - dest: "{{ roundcube_home }}" + dest: "{{ roundcube_app_home }}" owner: root group: www-data mode: "a-rwx,u+rwX,g+rX" extra_opts: ['--strip-components=1'] - exclude: - - "{{ roundcube_config_path }}" - name: Put roundcube configuration ansible.builtin.template: @@ -32,10 +35,8 @@ ansible.builtin.file: state: directory recurse: true - dest: "{{ roundcube_home }}/{{ item }}" + dest: "{{ roundcube_app_home }}/{{ item }}" owner: root group: www-data mode: "g+w" - loop: - - "logs" - - "temp" + loop: "{{ roundcube_writable_app_dirs }}" diff --git a/roles/roundcube/tasks/roundcube_carddav.yml b/roles/roundcube/tasks/roundcube_carddav.yml index 099a1d9..2265947 100644 --- a/roles/roundcube/tasks/roundcube_carddav.yml +++ b/roles/roundcube/tasks/roundcube_carddav.yml @@ -1,10 +1,15 @@ --- +- name: Remove carddav plugin + ansible.builtin.file: + state: absent + dest: "{{ roundcube_app_home }}/plugins/carddav" + - name: Unzip carddav plugin ansible.builtin.unarchive: remote_src: true src: "{{ roundcube_carddav_url }}" - dest: "{{ roundcube_home }}/plugins" + dest: "{{ roundcube_app_home }}/plugins" owner: root group: www-data mode: "a-rwx,u+rwX,g+rX" @@ -12,7 +17,7 @@ - name: Put carddav config file ansible.builtin.template: src: "carddav.config.inc.php.j2" - dest: "{{ roundcube_home }}/plugins/carddav/config.inc.php" + dest: "{{ roundcube_app_home }}/plugins/carddav/config.inc.php" owner: root group: www-data mode: "0o640" diff --git a/roles/roundcube/vars/main.yml b/roles/roundcube/vars/main.yml index c7f864f..086b7c4 100644 --- a/roles/roundcube/vars/main.yml +++ b/roles/roundcube/vars/main.yml @@ -7,9 +7,15 @@ roundcube_url: "https://github.com/roundcube/roundcubemail/releases/download/{{ # only the first occurence is supported roundcube_access_url: "{{ web_hostname | selectattr('type', 'defined') | selectattr('type', '==', 'roundcube') | map(attribute='host') | first }}" -roundcube_home: "/srv/http/{{ roundcube_access_url }}" -roundcube_config_path: "{{ roundcube_home }}/config/config.inc.php" +roundcube_app_home: "/var/www/{{ roundcube_access_url }}" +roundcube_config_path: "{{ roundcube_app_home }}/config/config.inc.php" +# App dirs +roundcube_writable_app_dirs: + - logs + - temp + +# CardDAV extension roundcube_carddav_version: "5.1.0" roundcube_carddav_url: "https://github.com/mstilkerich/rcmcarddav/releases/download/v{{ roundcube_carddav_version }}/carddav-v{{ roundcube_carddav_version }}.tar.gz" roundcube_carddav_discovery_url: "{{ web_hostname | selectattr('type', 'defined') | selectattr('type', '==', 'nextcloud') | map(attribute='host') | first }}"