From 2c129af42191d8e8d21d92c511450988cbf8aeb6 Mon Sep 17 00:00:00 2001 From: Daniel Chamot Date: Mon, 26 Jun 2017 11:24:20 +0200 Subject: [PATCH 1/3] add 'ml' to es_xpack_features --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 59f01af..0828b7f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,7 +24,7 @@ es_max_open_files: 65536 es_max_map_count: 262144 es_allow_downgrades: false es_enable_xpack: false -es_xpack_features: ["alerting","monitoring","graph","security"] +es_xpack_features: ["alerting","monitoring","graph","ml","security"] #These are used for internal operations performed by ansible. #They do not effect the current configuration es_api_host: "localhost" From 5d85d03c9c4aafa5e38fe47cf5fd2693dfd9e01c Mon Sep 17 00:00:00 2001 From: Daniel Chamot Date: Mon, 26 Jun 2017 11:25:14 +0200 Subject: [PATCH 2/3] add missing 'ml' and 'graph' to templates/elasticsearch.yml.j2 --- templates/elasticsearch.yml.j2 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/elasticsearch.yml.j2 b/templates/elasticsearch.yml.j2 index c0cc584..a0c8f84 100644 --- a/templates/elasticsearch.yml.j2 +++ b/templates/elasticsearch.yml.j2 @@ -30,4 +30,12 @@ xpack.monitoring.enabled: false {% if not "alerting" in es_xpack_features %} xpack.watcher.enabled: false -{% endif %} \ No newline at end of file +{% endif %} + +{% if not "ml" in es_xpack_features %} +xpack.ml.enabled: false +{% endif %} + +{% if not "graph" in es_xpack_features %} +xpack.graph.enabled: false +{% endif %} From c127cb39d112dab50e1839b40c2a28f540001887 Mon Sep 17 00:00:00 2001 From: Daniel Chamot Date: Mon, 26 Jun 2017 12:13:34 +0200 Subject: [PATCH 3/3] add x-pack local install tasks --- tasks/xpack/elasticsearch-xpack-install.yml | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tasks/xpack/elasticsearch-xpack-install.yml b/tasks/xpack/elasticsearch-xpack-install.yml index 16bbc5a..5d9bdb7 100644 --- a/tasks/xpack/elasticsearch-xpack-install.yml +++ b/tasks/xpack/elasticsearch-xpack-install.yml @@ -26,13 +26,32 @@ #Install plugin if not installed, or the es version has changed (so removed above), and its been requested -- name: Install x-pack plugin +- 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 + 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: + CONF_DIR: "{{ conf_dir }}" + ES_INCLUDE: "{{ instance_default_file }}" + +- 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 command: > {{es_home}}/bin/elasticsearch-plugin install --silent --batch x-pack {% if es_proxy_host is defined and es_proxy_host != '' %} -Dhttp.proxyHost={{ es_proxy_host }} -Dhttp.proxyPort={{ es_proxy_port }} {% endif %} register: xpack_state failed_when: "'ERROR' in xpack_state.stdout" changed_when: xpack_state.rc == 0 - when: (x_pack_installed.rc == 1 or es_version_changed) and es_enable_xpack + when: (x_pack_installed.rc == 1 or es_version_changed) and (es_enable_xpack and es_xpack_custom_url is not defined) notify: restart elasticsearch environment: CONF_DIR: "{{ conf_dir }}"