2016-07-22 23:44:27 +01:00
---
2016-07-23 22:37:22 +01:00
2016-11-03 16:11:57 +01:00
- set_fact : es_version_changed={{ ((elasticsearch_install_from_package is defined and (debian_elasticsearch_install_from_repo.changed or redhat_elasticsearch_install_from_repo.changed)) or (elasticsearch_install_from_package is defined and elasticsearch_install_from_package.changed)) }}
2016-07-23 22:37:22 +01:00
2016-07-24 17:39:44 +01:00
#enabling xpack installs the license. Not a xpack feature and does not need to be specified - TODO: we should append it to the list if xpack is enabled and remove this
2016-07-24 15:25:32 +01:00
2016-07-22 23:44:27 +01:00
#Check if license is installed
2017-01-04 13:23:22 +00:00
- name : Check License plugin is installed
2016-07-22 23:44:27 +01:00
shell : >
2017-01-11 10:26:57 +00:00
{{es_home}}/bin/elasticsearch-plugin list | tail -n +2 | grep license
2016-07-22 23:44:27 +01:00
register : license_installed
ignore_errors : yes
2016-07-24 17:39:44 +01:00
failed_when : "'ERROR' in license_installed.stdout"
2016-07-22 23:44:27 +01:00
changed_when : False
environment :
CONF_DIR : "{{ conf_dir }}"
ES_INCLUDE : "{{ instance_default_file }}"
2016-07-23 21:47:27 +01:00
#Remove license if installed and xpack not enabled
- name : Remove license plugin
command : >
2017-01-11 10:26:57 +00:00
{{es_home}}/bin/elasticsearch-plugin remove license
2016-07-23 22:18:31 +01:00
register : xpack_state
failed_when : "'ERROR' in xpack_state.stdout"
changed_when : xpack_state.rc == 0
2016-07-23 22:37:22 +01:00
when : license_installed.rc == 0 and (not es_enable_xpack or es_version_changed)
2016-07-23 21:47:27 +01:00
notify : restart elasticsearch
environment :
CONF_DIR : "{{ conf_dir }}"
ES_INCLUDE : "{{ instance_default_file }}"
2016-07-23 22:37:22 +01:00
#Install License if not installed, or it needs to be reinstalled due to ES change (above task will have removed), and its been requested.
2016-07-22 23:44:27 +01:00
- name : Install license plugin
command : >
2017-01-11 10:26:57 +00:00
{{es_home}}/bin/elasticsearch-plugin install license
2016-07-23 22:18:31 +01:00
register : xpack_state
failed_when : "'ERROR' in xpack_state.stdout"
changed_when : xpack_state.rc == 0
2016-07-23 22:37:22 +01:00
when : (license_installed.rc == 1 or es_version_changed) and es_enable_xpack
2016-07-22 23:44:27 +01:00
notify : restart elasticsearch
environment :
CONF_DIR : "{{ conf_dir }}"
ES_INCLUDE : "{{ instance_default_file }}"
2016-07-24 17:39:44 +01:00
#We loop on all as we may need to remove some features.
2016-07-24 15:25:32 +01:00
- include : elasticsearch-xpack-install.yml
with_items : "{{supported_xpack_features}}"
#Shield configuration
2016-07-23 19:48:50 +01:00
- include : shield/elasticsearch-shield.yml
2016-07-22 23:44:27 +01:00
2016-09-19 17:40:42 +02:00
#Add any feature specific configuration here
2016-07-23 19:48:50 +01:00
- name : Set Plugin Directory Permissions
2016-11-02 14:29:11 +01:00
file : state=directory path={{ es_home }}/plugins owner={{ es_user }} group={{ es_group }} recurse=yes