From 89601d731d988b22831294b2594b85b173657cd6 Mon Sep 17 00:00:00 2001 From: Shri Bodas Date: Wed, 10 Jan 2018 09:49:24 -0800 Subject: [PATCH] Bootstrap changes only for ES 6.x and with xpack --- tasks/xpack/elasticsearch-xpack.yml | 1 + tasks/xpack/security/elasticsearch-security.yml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tasks/xpack/elasticsearch-xpack.yml b/tasks/xpack/elasticsearch-xpack.yml index d429f8a..8478a6b 100644 --- a/tasks/xpack/elasticsearch-xpack.yml +++ b/tasks/xpack/elasticsearch-xpack.yml @@ -16,3 +16,4 @@ - name: Set elasticsearch.keystore Permissions become: yes file: state=file path={{ conf_dir }}/elasticsearch.keystore owner={{ es_user }} group={{ es_group }} + when: es_enable_xpack and "security" in es_xpack_features and (es_version | version_compare('6.0.0', '>')) diff --git a/tasks/xpack/security/elasticsearch-security.yml b/tasks/xpack/security/elasticsearch-security.yml index 6e7dffe..7247052 100644 --- a/tasks/xpack/security/elasticsearch-security.yml +++ b/tasks/xpack/security/elasticsearch-security.yml @@ -18,12 +18,13 @@ register: list_keystore environment: ES_PATH_CONF: "{{ conf_dir }}" - + when: + - (es_enable_xpack and '"security" in es_xpack_features') and (es_version | version_compare('6.0.0', '>')) - name: Create Bootstrap password for elastic user shell: echo "{{es_api_basic_auth_password}}" | {{es_home}}/bin/elasticsearch-keystore add -x 'bootstrap.password' when: - - es_api_basic_auth_username == 'elastic' and 'bootstrap.password' not in list_keystore.stdout_lines + - (es_enable_xpack and '"security" in es_xpack_features') and (es_version | version_compare('6.0.0', '>')) and es_api_basic_auth_username is defined and list_keystore is defined and es_api_basic_auth_username == 'elastic' and 'bootstrap.password' not in list_keystore.stdout_lines environment: ES_PATH_CONF: "{{ conf_dir }}" no_log: true