From a2f04ffecbbbe831c659eee8bba4dc9c14f4e514 Mon Sep 17 00:00:00 2001
From: root <root@srv2.soctools.grena.ge>
Date: Mon, 31 Oct 2022 17:41:34 +0400
Subject: [PATCH] fixes to migrate elasticsearch/odfe/kibana with opensearch
and opensearch dashboards
---
inventories/filebeat | 2 +-
roles/opensearch-dashboards/tasks/init.yml | 2 +-
roles/opensearch-dashboards/tasks/start.yml | 4 ++--
roles/opensearches/tasks/init.yml | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/inventories/filebeat b/inventories/filebeat
index a44ad5a..823f542 100644
--- a/inventories/filebeat
+++ b/inventories/filebeat
@@ -5,7 +5,7 @@ soctools-nifi-3 ansible_connection=docker FILEBEAT_FILES='["/opt/nifi/nifi-curre
soctools-misp ansible_connection=docker FILEBEAT_FILES='["/var/opt/rh/rh-php72/log/php-fpm/*.log","/var/opt/rh/rh-redis32/log/redis/redis.log","/var/log/httpd/*log","/var/log/supervisor/*.log"]' FILEBEAT_LOG_TYPE="misp" FILEBEAT_LOG_FORMAT="text"
soctools-opensearch-1 ansible_connection=docker FILEBEAT_FILES='["/usr/share/elasticsearch/logs/soctools-cluster_server.json"]' FILEBEAT_LOG_TYPE="elasticsearch" FILEBEAT_LOG_FORMAT="json"
soctools-opensearch-2 ansible_connection=docker FILEBEAT_FILES='["/usr/share/elasticsearch/logs/soctools-cluster_server.json"]' FILEBEAT_LOG_TYPE="elasticsearch" FILEBEAT_LOG_FORMAT="json"
-opensearch-dashboards ansible_connection=docker FILEBEAT_FILES='["/var/log/supervisor/kibana_stdout.log"]' FILEBEAT_LOG_TYPE="kibana" FILEBEAT_LOG_FORMAT="json"
+soctools-opensearch-dashboards ansible_connection=docker FILEBEAT_FILES='["/var/log/supervisor/opensearch-dashboards_stdout.log"]' FILEBEAT_LOG_TYPE="opensearch-dashboards" FILEBEAT_LOG_FORMAT="json"
soctools-keycloak ansible_connection=docker FILEBEAT_FILES='["/var/log/supervisor/*.log"]' FILEBEAT_LOG_TYPE="keycloak" FILEBEAT_LOG_FORMAT="json"
soctools-mysql ansible_connection=docker FILEBEAT_FILES='["/var/opt/rh/rh-mariadb103/log/mariadb/mariadb.log","/var/opt/rh/rh-mariadb103/lib/mysql/server_audit.log"]' FILEBEAT_LOG_TYPE="mysql" FILEBEAT_LOG_FORMAT="text"
soctools-haproxy ansible_connection=docker FILEBEAT_SYSLOG_PORT=9000 FILEBEAT_LOG_TYPE="haproxy" FILEBEAT_LOG_FORMAT="text"
diff --git a/roles/opensearch-dashboards/tasks/init.yml b/roles/opensearch-dashboards/tasks/init.yml
index f098cec..b7eee6c 100644
--- a/roles/opensearch-dashboards/tasks/init.yml
+++ b/roles/opensearch-dashboards/tasks/init.yml
@@ -69,7 +69,7 @@
remote_user: dashboards
shell: 'curl -k -b /tmp/cookie.txt -c /tmp/cookie.txt -X "GET" "https://{{soctoolsproxy}}:5601/api/status" \
--user admin:{{lookup("password", "{{playbook_dir}}/secrets/passwords/opensearches_adminpass")}} \
- | egrep ''"overall":{[^}]*"state":"green"'''
+ | egrep "status....overall....since...[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,2}.[0-9]{3}Z...state...green"'
register: result
until: result.rc == 0
retries: 90
diff --git a/roles/opensearch-dashboards/tasks/start.yml b/roles/opensearch-dashboards/tasks/start.yml
index dfe139f..ea222f8 100644
--- a/roles/opensearch-dashboards/tasks/start.yml
+++ b/roles/opensearch-dashboards/tasks/start.yml
@@ -15,10 +15,10 @@
- name: Check Opensearch Dashboards health
remote_user: dashboards
shell: 'curl -k -b /tmp/cookie.txt -c /tmp/cookie.txt -X "GET" "https://{{soctoolsproxy}}:5601/api/status" \
- | egrep status....overall....state...green'
+ --user admin:{{lookup("password", "{{playbook_dir}}/secrets/passwords/opensearches_adminpass")}} \
+ | egrep "status....overall....since...[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,2}.[0-9]{3}Z...state...green"'
register: result
until: result.rc == 0
retries: 90
delay: 2
ignore_errors: yes
-
diff --git a/roles/opensearches/tasks/init.yml b/roles/opensearches/tasks/init.yml
index fd8baac..8b438a4 100644
--- a/roles/opensearches/tasks/init.yml
+++ b/roles/opensearches/tasks/init.yml
@@ -33,7 +33,7 @@
- name: Change password for admin
remote_user: opensearch
- shell: export OPENSEARCH_JAVA_HOME=/opt/opensearch/jdk; bash plugins/opensearch-security/tools/hash.sh -p {{lookup('password', '{{playbook_dir}}/secrets/passwords/opensearches_adminpass')}}
+ shell: export OPENSEARCH_JAVA_HOME=/opt/opensearch/jdk; bash plugins/opensearch-security/tools/hash.sh -p {{lookup('password', '{{playbook_dir}}/secrets/passwords/opensearches_adminpass')}} | tail -n 1
register: adminhash
- set_fact:
@@ -42,7 +42,7 @@
- name: Change password for cortex
remote_user: opensearch
- shell: export OPENSEARCH_JAVA_HOME=/opt/opensearch/jdk; bash plugins/opensearch-security/tools/hash.sh -p {{lookup('password', '{{playbook_dir}}/secrets/passwords/cortex_opensearch')}}
+ shell: export OPENSEARCH_JAVA_HOME=/opt/opensearch/jdk; bash plugins/opensearch-security/tools/hash.sh -p {{lookup('password', '{{playbook_dir}}/secrets/passwords/cortex_opensearch')}} | tail -n 1
register: cortexhash
- set_fact:
--
GitLab