From 8f22be6f998fb65912fce999a44cf20b5bae42a5 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 13 May 2023 08:36:33 +0200 Subject: [PATCH] Add missing update script --- templates/update-opensearch-plugins.j2 | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 templates/update-opensearch-plugins.j2 diff --git a/templates/update-opensearch-plugins.j2 b/templates/update-opensearch-plugins.j2 new file mode 100644 index 0000000..b00a65a --- /dev/null +++ b/templates/update-opensearch-plugins.j2 @@ -0,0 +1,35 @@ +#!/bin/sh +# {{ ansible_managed }} + +set -eu + +OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin +OPENSEARCH_SERVICE=opensearch.service +PLUGINS=( + ingest-attachment +) + +ACTION="${1:-help}" + +case "$ACTION" in + purge) + for plugin in "${PLUGINS[@]}"; do + $OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin --batch + done + systemctl restart $OPENSEARCH_SERVICE + ;; + install) + for plugin in "${PLUGINS[@]}"; do + $OPENSEARCH_BIN_PATH/opensearch-plugin install $plugin --batch + done + systemctl restart $OPENSEARCH_SERVICE + ;; + help) + echo "Syntax: $(basename "$0") { purge | install | help }" + echo + ;; + *) + "$0" help >&2 + exit 1 + ;; +esac