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_http_port: 9200
|
||||||
opensearch_plugin_update_script: update-opensearch-plugins
|
opensearch_plugin_update_script: update-opensearch-plugins
|
||||||
opensearch_monit_service: opensearch
|
opensearch_monit_service: opensearch
|
||||||
|
|
||||||
|
opensearch_plugins:
|
||||||
|
- ingest-attachment
|
||||||
|
|
|
@ -14,11 +14,12 @@
|
||||||
|
|
||||||
- name: "Opensearch | Install plugins"
|
- name: "Opensearch | Install plugins"
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: ./opensearch-plugin install ingest-attachment --batch
|
cmd: "./opensearch-plugin install {{ item }} --batch"
|
||||||
chdir: /usr/share/opensearch/bin/
|
chdir: /usr/share/opensearch/bin/
|
||||||
creates: /usr/share/opensearch/plugins/ingest-attachment
|
creates: "/usr/share/opensearch/plugins/{{ item }}"
|
||||||
become: true
|
become: true
|
||||||
become_user: opensearch
|
become_user: opensearch
|
||||||
|
loop: "{{ opensearch_plugins }}"
|
||||||
|
|
||||||
- name: "Opensearch | Copy opensearch configuration"
|
- name: "Opensearch | Copy opensearch configuration"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
|
|
@ -5,20 +5,23 @@ set -eu
|
||||||
|
|
||||||
OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin
|
OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin
|
||||||
OPENSEARCH_SERVICE=opensearch.service
|
OPENSEARCH_SERVICE=opensearch.service
|
||||||
|
PLUGINS=(
|
||||||
|
{% for plugin in opensearch_plugins %}
|
||||||
|
{% if not loop.last %}
|
||||||
|
{{ plugin }}
|
||||||
|
{% else %}
|
||||||
|
{{ plugin }})
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
ACTION="${1:-help}"
|
ACTION="${1:-help}"
|
||||||
|
|
||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
purge)
|
purge)
|
||||||
PLUGINS=$($OPENSEARCH_BIN_PATH/opensearch-plugin list | grep -v opensearch- || true)
|
for plugin in "${PLUGINS[@]}"; do
|
||||||
if [[ -z "$PLUGINS" ]]; then
|
$OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin
|
||||||
exit 0
|
done
|
||||||
else
|
systemctl restart $OPENSEARCH_SERVICE
|
||||||
for plugin in "${PLUGINS[@]}"; do
|
|
||||||
$OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin
|
|
||||||
done
|
|
||||||
systemctl restart $OPENSEARCH_SERVICE
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
install)
|
install)
|
||||||
for plugin in "${PLUGINS[@]}"; do
|
for plugin in "${PLUGINS[@]}"; do
|
||||||
|
|
Loading…
Add table
Reference in a new issue