From da64a36bc2cbaf4b877b199362757184b869a6b6 Mon Sep 17 00:00:00 2001
From: Christian Berendt <berendt@betacloud-solutions.de>
Date: Tue, 2 Jun 2020 16:58:46 +0200
Subject: [PATCH] Support custom elasticsearch configuration files

Change-Id: Id43627c6b6d305d0efbdd27ac5a2efbd5bee9107
---
 ansible/roles/elasticsearch/tasks/config.yml              | 8 ++++++--
 .../add-custom-elasticsearch-conf-6fc34fbc3b471997.yaml   | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 releasenotes/notes/add-custom-elasticsearch-conf-6fc34fbc3b471997.yaml

diff --git a/ansible/roles/elasticsearch/tasks/config.yml b/ansible/roles/elasticsearch/tasks/config.yml
index 4b73ecfc6..28dde4997 100644
--- a/ansible/roles/elasticsearch/tasks/config.yml
+++ b/ansible/roles/elasticsearch/tasks/config.yml
@@ -30,8 +30,12 @@
     - Restart {{ item.key }} container
 
 - name: Copying over elasticsearch service config files
-  template:
-    src: "{{ item.key }}.yml.j2"
+  merge_yaml:
+    sources:
+      - "{{ role_path }}/templates/{{ item.key }}.yml.j2"
+      - "{{ node_custom_config }}/elasticsearch.yml"
+      - "{{ node_custom_config }}/elasticsearch/{{ item.key }}.yml"
+      - "{{ node_custom_config }}/elasticsearch/{{ inventory_hostname }}/{{ item.key }}.yml"
     dest: "{{ node_config_directory }}/{{ item.key }}/{{ item.key }}.yml"
     mode: "0660"
   become: true
diff --git a/releasenotes/notes/add-custom-elasticsearch-conf-6fc34fbc3b471997.yaml b/releasenotes/notes/add-custom-elasticsearch-conf-6fc34fbc3b471997.yaml
new file mode 100644
index 000000000..2cc416c7a
--- /dev/null
+++ b/releasenotes/notes/add-custom-elasticsearch-conf-6fc34fbc3b471997.yaml
@@ -0,0 +1,3 @@
+---
+features:
+  - Adds ability to provide a custom elasticsearch config.
-- 
GitLab