Merge pull request #271 from veger/improve_plugin_handling
Fix adding of plugins when es_plugins_reinstall is false
This commit is contained in:
commit
51d488c555
1 changed files with 10 additions and 3 deletions
|
|
@ -28,12 +28,19 @@
|
||||||
- set_fact: plugins_to_remove="{{ installed_plugins.stdout_lines | difference(es_plugins | json_query('[*].plugin')) | default([]) }}"
|
- set_fact: plugins_to_remove="{{ installed_plugins.stdout_lines | difference(es_plugins | json_query('[*].plugin')) | default([]) }}"
|
||||||
when: not es_plugins_reinstall
|
when: not es_plugins_reinstall
|
||||||
|
|
||||||
|
#if es_plugins_reinstall is set to true we (re)install ALL plugins
|
||||||
|
- set_fact: plugins_to_install="{{ es_plugins | json_query('[*].plugin') | default([]) }}"
|
||||||
|
when: es_plugins_reinstall
|
||||||
|
|
||||||
|
#if the plugins listed are different than those requested, we install those not installed but listed in the config
|
||||||
|
- set_fact: plugins_to_install="{{ es_plugins | json_query('[*].plugin') | difference(installed_plugins.stdout_lines) | default([]) }}"
|
||||||
|
when: not es_plugins_reinstall
|
||||||
|
|
||||||
# This removes any currently installed plugins (to prevent errors when reinstalling)
|
# This removes any currently installed plugins (to prevent errors when reinstalling)
|
||||||
- name: Remove elasticsearch plugins
|
- name: Remove elasticsearch plugins
|
||||||
command: "{{es_home}}/bin/elasticsearch-plugin remove {{item}} --silent"
|
command: "{{es_home}}/bin/elasticsearch-plugin remove {{item}} --silent"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
with_items: "{{ plugins_to_remove | default([]) }}"
|
with_items: "{{ plugins_to_remove | default([]) }}"
|
||||||
when: es_plugins_reinstall and plugins_to_remove | length > 0
|
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
register: plugin_removed
|
register: plugin_removed
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -45,8 +52,8 @@
|
||||||
register: plugin_installed
|
register: plugin_installed
|
||||||
failed_when: "'ERROR' in plugin_installed.stdout"
|
failed_when: "'ERROR' in plugin_installed.stdout"
|
||||||
changed_when: plugin_installed.rc == 0
|
changed_when: plugin_installed.rc == 0
|
||||||
with_items: "{{ es_plugins | default([]) }}"
|
with_items: "{{ es_plugins }}"
|
||||||
when: not es_plugins is none and es_plugins_reinstall
|
when: "{{ item.plugin in plugins_to_install }}"
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
environment:
|
environment:
|
||||||
CONF_DIR: "{{ conf_dir }}"
|
CONF_DIR: "{{ conf_dir }}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue