Support for removal for shield and license

This commit is contained in:
Dale McDiarmid 2016-07-23 21:47:27 +01:00
parent 9a83511801
commit 5d3616bd20
4 changed files with 45 additions and 17 deletions

View file

@ -27,8 +27,8 @@
when: es_plugins is defined or es_plugins_reinstall when: es_plugins is defined or es_plugins_reinstall
tags: tags:
- plugins - plugins
#We always execute xpack as we may need to remove features
- include: xpack/elasticsearch-xpack.yml - include: xpack/elasticsearch-xpack.yml
when: es_enable_xpack
tags: tags:
- xpack - xpack
- include: elasticsearch-service.yml - include: elasticsearch-service.yml

View file

@ -10,21 +10,36 @@
CONF_DIR: "{{ conf_dir }}" CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}" ES_INCLUDE: "{{ instance_default_file }}"
#Install License if not installed #Remove license if installed and xpack not enabled
- name: Install license plugin - name: Remove license plugin
command: > command: >
{{es_home}}/bin/plugin install license {{es_home}}/bin/plugin remove license
register: license register: license_change
failed_when: "'ERROR' in license_installed .stdout" failed_when: "'ERROR' in license.stdout"
changed_when: license.rc == 1 changed_when: license_change.rc == 1
when: license_installed.rc == 1 when: license_installed.rc == 0 and not es_enable_xpack
notify: restart elasticsearch notify: restart elasticsearch
environment: environment:
CONF_DIR: "{{ conf_dir }}" CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}" ES_INCLUDE: "{{ instance_default_file }}"
#Install License if not installed
- name: Install license plugin
command: >
{{es_home}}/bin/plugin install license
register: license_change
failed_when: "'ERROR' in license_change.stdout"
changed_when: license_change.rc == 0
when: license_installed.rc == 1 and es_enable_xpack
notify: restart elasticsearch
environment:
CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}"
#Include shield as we may need to remove it
- include: shield/elasticsearch-shield.yml - include: shield/elasticsearch-shield.yml
when: '"shield" in es_xpack_features' # when: '"shield" in es_xpack_features'
#Any other xpacks plugins requiring configuration to be entered here #Any other xpacks plugins requiring configuration to be entered here

View file

@ -1,7 +1,6 @@
--- ---
#Test if we need to install shield #Test if shield is installed
- shell: "{{es_home}}/bin/plugin list | sed -n '1!p' | grep shield" - shell: "{{es_home}}/bin/plugin list | sed -n '1!p' | grep shield"
register: shield_installed register: shield_installed
changed_when: False changed_when: False
@ -11,14 +10,28 @@
ES_INCLUDE: "{{ instance_default_file }}" ES_INCLUDE: "{{ instance_default_file }}"
#Install Shield if not installed #Remove Shield if installed and its not been requested
- name: Remove shield plugin
command: >
{{es_home}}/bin/plugin remove shield
register: shield_change
failed_when: "'ERROR' in shield_change.stdout"
changed_when: shield_change.rc == 0
when: shield_installed.rc == 0 and (not es_enable_xpack or not '"shield" in es_xpack_features')
notify: restart elasticsearch
environment:
CONF_DIR: "{{ conf_dir }}"
ES_INCLUDE: "{{ instance_default_file }}"
#Install Shield if not installed and its been requested
- name: Install shield plugin - name: Install shield plugin
command: > command: >
{{es_home}}/bin/plugin install shield {{es_home}}/bin/plugin install shield
register: shield register: shield_change
failed_when: "'ERROR' in shield_installed.stdout" failed_when: "'ERROR' in shield_change.stdout"
changed_when: shield.rc == 1 changed_when: shield_change.rc == 0
when: shield_installed.rc == 1 when: shield_installed.rc == 1 and es_enable_xpack and '"shield" in es_xpack_features'
notify: restart elasticsearch notify: restart elasticsearch
environment: environment:
CONF_DIR: "{{ conf_dir }}" CONF_DIR: "{{ conf_dir }}"
@ -41,3 +54,4 @@
- name: Ensure shield conf directory exists - name: Ensure shield conf directory exists
file: path={{ conf_dir }}/shield state=directory owner={{ es_user }} group={{ es_group }} file: path={{ conf_dir }}/shield state=directory owner={{ es_user }} group={{ es_group }}
changed_when: False changed_when: False
when: es_enable_xpack and '"shield" in es_xpack_features'

View file

@ -8,7 +8,6 @@
es_enable_xpack: true es_enable_xpack: true
es_xpack_features: es_xpack_features:
- shield - shield
- watcher
es_api_basic_auth_username: es_admin es_api_basic_auth_username: es_admin
es_api_basic_auth_password: changeMe es_api_basic_auth_password: changeMe
es_users: es_users: