From cc6b4e78e276c1b5038e259d43cf0277f6e556f8 Mon Sep 17 00:00:00 2001 From: Bill Schwanitz Date: Tue, 26 Jun 2018 15:13:19 -0400 Subject: [PATCH] add missing become: yes --- tasks/elasticsearch-config.yml | 5 +++-- tasks/main.yml | 1 + tasks/xpack/security/elasticsearch-security.yml | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tasks/elasticsearch-config.yml b/tasks/elasticsearch-config.yml index d7bb095..1c21d39 100644 --- a/tasks/elasticsearch-config.yml +++ b/tasks/elasticsearch-config.yml @@ -93,13 +93,14 @@ stat: path: "{{ sysd_script }}" register: sysd_stat_result - + - name: Remove if it is a normal file + become: yes file: path: "{{ sysd_script }}" state: absent when: not sysd_stat_result.stat.islnk - + - name: Create a symbolic link to the default systemd location to the first instance running on this host become: yes file: diff --git a/tasks/main.yml b/tasks/main.yml index ce759e1..e98b98d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -56,6 +56,7 @@ meta: flush_handlers - name: Make sure elasticsearch is started + become: yes service: name={{instance_init_script | basename}} state=started enabled=yes when: es_start_service diff --git a/tasks/xpack/security/elasticsearch-security.yml b/tasks/xpack/security/elasticsearch-security.yml index 3baa8fb..8f749f8 100644 --- a/tasks/xpack/security/elasticsearch-security.yml +++ b/tasks/xpack/security/elasticsearch-security.yml @@ -17,14 +17,16 @@ when: (es_enable_xpack and "security" in es_xpack_features) and (es_version | version_compare('6.0.0', '>')) block: - name: create the keystore if it doesn't exist yet + become: yes command: > {{es_home}}/bin/elasticsearch-keystore create args: creates: "{{ conf_dir }}/elasticsearch.keystore" environment: ES_PATH_CONF: "{{ conf_dir }}" - + - name: Check if bootstrap password is set + become: yes command: > {{es_home}}/bin/elasticsearch-keystore list register: list_keystore @@ -33,6 +35,7 @@ ES_PATH_CONF: "{{ conf_dir }}" - name: Create Bootstrap password for elastic user + become: yes shell: echo "{{es_api_basic_auth_password}}" | {{es_home}}/bin/elasticsearch-keystore add -x 'bootstrap.password' when: - 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