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