From dc53d4c41195061dc4e104cecf0d2ebec55401ae Mon Sep 17 00:00:00 2001
From: Alexandre Iooss <erdnaxe@crans.org>
Date: Mon, 7 Sep 2020 11:10:17 +0200
Subject: [PATCH] Clone plugins and add logo

---
 group_vars/roundcube.yml                          |  7 ++++++-
 roles/roundcube/tasks/main.yml                    | 15 +++++++++------
 .../templates/roundcube/config.inc.php.j2         |  9 +++++++++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/group_vars/roundcube.yml b/group_vars/roundcube.yml
index cbf3db15..9b772a86 100644
--- a/group_vars/roundcube.yml
+++ b/group_vars/roundcube.yml
@@ -18,4 +18,9 @@ roundcube_glob:
     - repo: 'https://gitlab.crans.org/nounous/roundcube-plugin-identity_smtp.git'
       name: identity_smtp
       version: HEAD
-
+    - name: zipdownload
+    - name: attachment_reminder
+    - name: newmail_notifier
+    - name: listcommands
+    - name: thunderbird_labels
+    - name: contextmenu
diff --git a/roles/roundcube/tasks/main.yml b/roles/roundcube/tasks/main.yml
index 73151518..18745b55 100644
--- a/roles/roundcube/tasks/main.yml
+++ b/roles/roundcube/tasks/main.yml
@@ -34,20 +34,23 @@
     dest: "/etc/roundcube/plugins/{{ item.name }}"
     version: "{{ item.version }}"
   loop: "{{ roundcube.plugins }}"
+  when: item.repo is defined
 
 - name: Symlink custom plugins (1)
   file:
-    src: "/usr/share/roundcube/plugins/{{ item }}"
-    dest: "/var/lib/roundcube/plugins/{{ item }}"
+    src: "/usr/share/roundcube/plugins/{{ item.name }}"
+    dest: "/var/lib/roundcube/plugins/{{ item.name }}"
     state: link
-  loop: "{{ roundcube.plugins | map(attribute='name') | list }}"
+  loop: "{{ roundcube.plugins }}"
+  when: item.repo is defined
 
 - name: Symlink custom plugins (2)
   file:
-    src: "/etc/roundcube/plugins/{{ item }}"
-    dest: "/usr/share/roundcube/plugins/{{ item }}"
+    src: "/etc/roundcube/plugins/{{ item.name }}"
+    dest: "/usr/share/roundcube/plugins/{{ item.name }}"
     state: link
-  loop: "{{ roundcube.plugins | map(attribute='name') | list }}"
+  loop: "{{ roundcube.plugins }}"
+  when: item.repo is defined
 
 - name: Copy NGINX site
   template:
diff --git a/roles/roundcube/templates/roundcube/config.inc.php.j2 b/roles/roundcube/templates/roundcube/config.inc.php.j2
index 85817b88..f49a0d9a 100644
--- a/roles/roundcube/templates/roundcube/config.inc.php.j2
+++ b/roles/roundcube/templates/roundcube/config.inc.php.j2
@@ -88,5 +88,14 @@ $config['skin'] = 'elastic';
 //         see defaults.inc.php for additional informations
 $config['enable_spellcheck'] = false;
 
+// Custom logo
+$config['skin_logo'] = array(
+    "elastic:login[small]" => "https://www.crans.org/images/crans_black.svg",
+    "elastic:login" => "https://www.crans.org/images/crans_black.svg",
+    "elastic:*" => "https://www.crans.org/images/crans.svg",
+    "larry:*" => "https://www.crans.org/images/crans_banner.png",
+    "classic:*" => "https://www.crans.org/images/crans_banner.png"
+);
+
 // This domain will be used to form e-mail addresses of new users
 $config['mail_domain'] = '{{ roundcube.mail_domain }}';
-- 
GitLab