Define plugin list
This commit is contained in:
parent
8f30abee4f
commit
982522ca8e
3 changed files with 18 additions and 11 deletions
|
@ -5,3 +5,6 @@ opensearch_network_host: 127.0.0.1
|
|||
opensearch_http_port: 9200
|
||||
opensearch_plugin_update_script: update-opensearch-plugins
|
||||
opensearch_monit_service: opensearch
|
||||
|
||||
opensearch_plugins:
|
||||
- ingest-attachment
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
|
||||
- name: "Opensearch | Install plugins"
|
||||
ansible.builtin.command:
|
||||
cmd: ./opensearch-plugin install ingest-attachment --batch
|
||||
cmd: "./opensearch-plugin install {{ item }} --batch"
|
||||
chdir: /usr/share/opensearch/bin/
|
||||
creates: /usr/share/opensearch/plugins/ingest-attachment
|
||||
creates: "/usr/share/opensearch/plugins/{{ item }}"
|
||||
become: true
|
||||
become_user: opensearch
|
||||
loop: "{{ opensearch_plugins }}"
|
||||
|
||||
- name: "Opensearch | Copy opensearch configuration"
|
||||
ansible.builtin.template:
|
||||
|
|
|
@ -5,20 +5,23 @@ set -eu
|
|||
|
||||
OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin
|
||||
OPENSEARCH_SERVICE=opensearch.service
|
||||
PLUGINS=(
|
||||
{% for plugin in opensearch_plugins %}
|
||||
{% if not loop.last %}
|
||||
{{ plugin }}
|
||||
{% else %}
|
||||
{{ plugin }})
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
ACTION="${1:-help}"
|
||||
|
||||
case "$ACTION" in
|
||||
purge)
|
||||
PLUGINS=$($OPENSEARCH_BIN_PATH/opensearch-plugin list | grep -v opensearch- || true)
|
||||
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
|
||||
for plugin in "${PLUGINS[@]}"; do
|
||||
$OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin
|
||||
done
|
||||
systemctl restart $OPENSEARCH_SERVICE
|
||||
;;
|
||||
install)
|
||||
for plugin in "${PLUGINS[@]}"; do
|
||||
|
|
Loading…
Add table
Reference in a new issue