2016-07-24 15:25:32 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
#Test if feature is installed
|
2017-01-11 10:26:57 +00:00
|
|
|
- shell: "{{es_home}}/bin/elasticsearch-plugin list{% if es_version | version_compare('5.0', '<') %} | sed -n '1!p' | cut -d '-' -f2-{% endif %} | grep {{item}}"
|
2016-07-24 15:25:32 +01:00
|
|
|
register: feature_installed
|
|
|
|
|
changed_when: False
|
2016-08-29 17:41:35 +01:00
|
|
|
failed_when: "'ERROR' in feature_installed.stdout"
|
2016-07-24 15:25:32 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
|
environment:
|
|
|
|
|
CONF_DIR: "{{ conf_dir }}"
|
|
|
|
|
ES_INCLUDE: "{{ instance_default_file }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Remove Plugin if installed and its not been requested or the ES version has changed
|
|
|
|
|
- name: Remove {{item}} plugin
|
2017-01-08 15:31:11 -08:00
|
|
|
command: "{{es_home}}/bin/plugin remove {{item}}"
|
2016-07-24 15:25:32 +01:00
|
|
|
register: xpack_state
|
|
|
|
|
failed_when: "'ERROR' in xpack_state.stdout"
|
|
|
|
|
changed_when: xpack_state.rc == 0
|
|
|
|
|
when: feature_installed.rc == 0 and (not es_enable_xpack or not '"{{item}}" in es_xpack_features' or es_version_changed)
|
|
|
|
|
notify: restart elasticsearch
|
|
|
|
|
environment:
|
|
|
|
|
CONF_DIR: "{{ conf_dir }}"
|
|
|
|
|
ES_INCLUDE: "{{ instance_default_file }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Install plugin if not installed, or the es version has changed (so removed above), and its been requested
|
|
|
|
|
- name: Install {{item}} plugin
|
|
|
|
|
command: >
|
2017-01-11 10:26:57 +00:00
|
|
|
{{es_home}}/bin/elasticsearch-plugin install {{item}}
|
2016-07-24 15:25:32 +01:00
|
|
|
register: xpack_state
|
|
|
|
|
failed_when: "'ERROR' in xpack_state.stdout"
|
|
|
|
|
changed_when: xpack_state.rc == 0
|
|
|
|
|
when: (feature_installed.rc == 1 or es_version_changed) and es_enable_xpack and "{{item}}" in es_xpack_features
|
|
|
|
|
notify: restart elasticsearch
|
|
|
|
|
environment:
|
|
|
|
|
CONF_DIR: "{{ conf_dir }}"
|
2016-11-02 14:29:11 +01:00
|
|
|
ES_INCLUDE: "{{ instance_default_file }}"
|