mirror of
https://github.com/aljazceru/ansible-elasticsearch.git
synced 2025-12-18 01:24:20 +01:00
Fixes issue 70, Improves plugin management, Refactoring, Updates tests, Introduces multiple data dir support
This commit is contained in:
@@ -1,22 +1,32 @@
|
||||
---
|
||||
|
||||
#es_plugins_reinstall will be set to true if elasticsearch_install.changed i.e. we have changed ES version
|
||||
#es_plugins_reinstall will be set to true if elasticsearch_install.changed i.e. we have changed ES version, or if no plugins listed. Otherwise it is false and requires explicitly setting.
|
||||
- set_fact: es_plugins_reinstall=true
|
||||
when: elasticsearch_install.changed
|
||||
when: elasticsearch_install.changed or es_plugins is not defined or es_plugins is none
|
||||
|
||||
- set_fact: list_command="list"
|
||||
|
||||
- set_fact: list_command="--list"
|
||||
when: es_version | version_compare('2.0', '<')
|
||||
|
||||
#List currently installed plugins
|
||||
- shell: "{{es_home}}/bin/plugin {{list_command}} | sed -n '1!p' | cut -d '-' -f2-"
|
||||
register: installed_plugins
|
||||
changed_when: False
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
ES_INCLUDE: "{{ instance_default_file }}"
|
||||
|
||||
|
||||
|
||||
#This needs to removed installed plugins not those listed
|
||||
#This needs to removes any currently installed plugins
|
||||
- name: Remove elasticsearch plugins
|
||||
command: "{{es_home}}/bin/plugin remove {{ item.plugin }} --silent"
|
||||
command: "{{es_home}}/bin/plugin remove {{item}} --silent"
|
||||
ignore_errors: yes
|
||||
with_items: es_plugins
|
||||
when: es_plugins_reinstall
|
||||
with_items: installed_plugins.stdout_lines
|
||||
when: es_plugins_reinstall and installed_plugins.stdout_lines | length > 0 and not 'No plugin detected' in installed_plugins.stdout_lines[0]
|
||||
notify: restart elasticsearch
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
ES_INCLUDE: "{{ instance_default_file }}"
|
||||
|
||||
- name: Install elasticsearch plugins
|
||||
#debug: var=item
|
||||
@@ -25,7 +35,7 @@
|
||||
failed_when: "'Failed to install' in plugin_installed.stderr"
|
||||
changed_when: plugin_installed.rc == 0
|
||||
with_items: es_plugins
|
||||
when: ansible_os_family == 'RedHat' or ansible_os_family == 'Debian'
|
||||
when: es_plugins is defined and not es_plugins is none
|
||||
notify: restart elasticsearch
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
|
||||
Reference in New Issue
Block a user