2016-07-24 15:25:32 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
#Test if feature is installed
|
2018-02-04 07:09:23 +00:00
|
|
|
- name: Test if x-pack is installed
|
|
|
|
|
shell: "{{es_home}}/bin/elasticsearch-plugin list | grep x-pack"
|
2017-05-12 13:31:50 -07:00
|
|
|
become: yes
|
2017-01-11 13:09:05 +00:00
|
|
|
register: x_pack_installed
|
2016-07-24 15:25:32 +01:00
|
|
|
changed_when: False
|
2017-01-11 13:09:05 +00:00
|
|
|
failed_when: "'ERROR' in x_pack_installed.stdout"
|
2017-03-07 14:47:32 +01:00
|
|
|
check_mode: no
|
2016-07-24 15:25:32 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
|
environment:
|
2019-06-03 14:18:09 +02:00
|
|
|
CONF_DIR: "{{ es_conf_dir }}"
|
|
|
|
|
ES_PATH_CONF: "{{ es_conf_dir }}"
|
|
|
|
|
ES_INCLUDE: "{{ default_file }}"
|
2016-07-24 15:25:32 +01:00
|
|
|
|
|
|
|
|
|
2017-01-11 13:09:05 +00:00
|
|
|
#Remove X-Pack if installed and its not been requested or the ES version has changed
|
|
|
|
|
- name: Remove x-pack plugin
|
2017-05-12 13:31:50 -07:00
|
|
|
become: yes
|
2017-01-11 13:09:05 +00:00
|
|
|
command: "{{es_home}}/bin/elasticsearch-plugin remove x-pack"
|
2016-07-24 15:25:32 +01:00
|
|
|
register: xpack_state
|
|
|
|
|
failed_when: "'ERROR' in xpack_state.stdout"
|
|
|
|
|
changed_when: xpack_state.rc == 0
|
2017-01-11 13:09:05 +00:00
|
|
|
when: x_pack_installed.rc == 0 and (not es_enable_xpack or es_version_changed)
|
2016-07-24 15:25:32 +01:00
|
|
|
notify: restart elasticsearch
|
|
|
|
|
environment:
|
2019-06-03 14:18:09 +02:00
|
|
|
CONF_DIR: "{{ es_conf_dir }}"
|
|
|
|
|
ES_PATH_CONF: "{{ es_conf_dir }}"
|
|
|
|
|
ES_INCLUDE: "{{ default_file }}"
|
2016-07-24 15:25:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#Install plugin if not installed, or the es version has changed (so removed above), and its been requested
|
2017-06-26 12:13:34 +02:00
|
|
|
- name: Download x-pack from url
|
|
|
|
|
get_url: url={{ es_xpack_custom_url }} dest=/tmp/x-pack-{{ es_version }}.zip
|
|
|
|
|
when: (x_pack_installed.rc == 1 or es_version_changed) and (es_enable_xpack and es_xpack_custom_url is defined)
|
|
|
|
|
|
|
|
|
|
- name: Install x-pack plugin from local
|
2017-09-19 14:22:02 -06:00
|
|
|
become: yes
|
2017-06-26 12:13:34 +02:00
|
|
|
command: >
|
|
|
|
|
{{es_home}}/bin/elasticsearch-plugin install --silent --batch file:///tmp/x-pack-{{ es_version }}.zip
|
|
|
|
|
register: xpack_state
|
|
|
|
|
changed_when: xpack_state.rc == 0
|
|
|
|
|
when: (x_pack_installed.rc == 1 or es_version_changed) and (es_enable_xpack and es_xpack_custom_url is defined)
|
|
|
|
|
notify: restart elasticsearch
|
|
|
|
|
environment:
|
2019-06-03 14:18:09 +02:00
|
|
|
CONF_DIR: "{{ es_conf_dir }}"
|
|
|
|
|
ES_PATH_CONF: "{{ es_conf_dir }}"
|
|
|
|
|
ES_INCLUDE: "{{ default_file }}"
|
2017-06-26 12:13:34 +02:00
|
|
|
|
|
|
|
|
- name: Delete x-pack zip file
|
|
|
|
|
file: dest=/tmp/x-pack-{{ es_version }}.zip state=absent
|
|
|
|
|
when: es_xpack_custom_url is defined
|
|
|
|
|
|
|
|
|
|
- name: Install x-pack plugin from elastic.co
|
2017-05-12 13:31:50 -07:00
|
|
|
become: yes
|
2016-07-24 15:25:32 +01:00
|
|
|
command: >
|
2017-08-15 14:48:12 +01:00
|
|
|
{{es_home}}/bin/elasticsearch-plugin install --silent --batch x-pack
|
2016-07-24 15:25:32 +01:00
|
|
|
register: xpack_state
|
|
|
|
|
failed_when: "'ERROR' in xpack_state.stdout"
|
|
|
|
|
changed_when: xpack_state.rc == 0
|
2017-06-26 12:13:34 +02:00
|
|
|
when: (x_pack_installed.rc == 1 or es_version_changed) and (es_enable_xpack and es_xpack_custom_url is not defined)
|
2016-07-24 15:25:32 +01:00
|
|
|
notify: restart elasticsearch
|
|
|
|
|
environment:
|
2019-06-03 14:18:09 +02:00
|
|
|
CONF_DIR: "{{ es_conf_dir }}"
|
|
|
|
|
ES_PATH_CONF: "{{ es_conf_dir }}"
|
|
|
|
|
ES_INCLUDE: "{{ default_file }}"
|
2017-08-15 14:48:12 +01:00
|
|
|
ES_JAVA_OPTS: "{% if es_proxy_host is defined and es_proxy_host != '' %}-Dhttp.proxyHost={{ es_proxy_host }} -Dhttp.proxyPort={{ es_proxy_port }} -Dhttps.proxyHost={{ es_proxy_host }} -Dhttps.proxyPort={{ es_proxy_port }}{% endif %}"
|