From 6a618aea7c435c76870b849444ac30e53e08402e Mon Sep 17 00:00:00 2001
From: root <root@srv2.soctools.grena.ge>
Date: Tue, 1 Nov 2022 11:39:47 +0400
Subject: [PATCH] fixes to migrate elasticsearch/odfe/kibana with opensearch
 and opensearch dashboards

---
 group_vars/all/main.yml                    |  1 +
 roles/opensearch-dashboards/tasks/init.yml | 37 ++++++++++++++--------
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/group_vars/all/main.yml b/group_vars/all/main.yml
index 18fa2b7..537ff37 100644
--- a/group_vars/all/main.yml
+++ b/group_vars/all/main.yml
@@ -80,6 +80,7 @@ opensearchdashboards_img: "{{repo}}/opensearch-dashboards:{{version}}{{suffix}}"
 elk_version: "oss-7.4.2"
 #odfeplugin_version: "1.7.0.0"
 odfeplugin_version: "1.4.0.0"
+kibana_plugins_version: "v0.7"
 
 openid_realm: "SOCTOOLS1"
 openid_scope: profile
diff --git a/roles/opensearch-dashboards/tasks/init.yml b/roles/opensearch-dashboards/tasks/init.yml
index b7eee6c..190a7a3 100644
--- a/roles/opensearch-dashboards/tasks/init.yml
+++ b/roles/opensearch-dashboards/tasks/init.yml
@@ -1,11 +1,22 @@
 ---
 
-#- name: Install the Hive Button plugin
-#  copy:
-#    src: "/tmp/kibana-plugins-{{kibana_plugins_version}}/thehive_button"
-#    dest: "/usr/share/kibana/plugins"
-#    owner: kibana
-#    remote_src: yes
+- name: Download kibana plugins
+  get_url:
+    url: "https://gitlab.geant.org/gn4-3-wp8-t3.1-soc/kibana-plugins/-/archive/{{ kibana_plugins_version }}/kibana-plugins-{{kibana_plugins_version}}.tar.gz"
+    dest: /tmp/kibana_plugins.tar.gz
+
+- name: Gunzip kibana plugins
+  unarchive:
+    src: "/tmp/kibana_plugins.tar.gz"
+    dest: /tmp
+    remote_src: yes
+
+- name: Install the Hive Button plugin
+  copy:
+    src: "/tmp/kibana-plugins-{{kibana_plugins_version}}/thehive_button"
+    dest: "/opt/opensearch-dashboards/plugins"
+    owner: dashboards
+    remote_src: yes
 
 - name: Copy cacert to ca-trust dir
   remote_user: root
@@ -44,13 +55,13 @@
   with_items:
     - opensearch_dashboards.yml
 
-#- name: Generate configuration for thehive_button plugin
-#  remote_user: dashboards
-#  template:
-#    src: files/env.js.j2
-#    dest: "/opt/opensearch-dashboards/plugins/thehive_button/public/env.js"
-#    owner: dashboards
-#    group: dashboards
+- name: Generate configuration for thehive_button plugin
+  remote_user: dashboards
+  template:
+    src: files/env.js.j2
+    dest: "/opt/opensearch-dashboards/plugins/thehive_button/public/env.js"
+    owner: dashboards
+    group: dashboards
 
 
 - name: Start Opensearch Dashboards
-- 
GitLab