2023-05-13 09:05:28 +02:00
|
|
|
#!/bin/bash
|
2023-05-13 08:36:33 +02:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin
|
|
|
|
OPENSEARCH_SERVICE=opensearch.service
|
|
|
|
|
|
|
|
ACTION="${1:-help}"
|
|
|
|
|
|
|
|
case "$ACTION" in
|
|
|
|
purge)
|
2023-05-14 12:11:11 +02:00
|
|
|
PLUGINS=$($OPENSEARCH_BIN_PATH/opensearch-plugin list | grep -v opensearch- || true)
|
2023-05-13 09:05:28 +02:00
|
|
|
if [[ -z "$PLUGINS" ]]; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
for plugin in "${PLUGINS[@]}"; do
|
|
|
|
$OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin
|
|
|
|
done
|
|
|
|
systemctl restart $OPENSEARCH_SERVICE
|
|
|
|
fi
|
2023-05-13 08:36:33 +02:00
|
|
|
;;
|
|
|
|
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
|