Add SSL support to Elasticsearch
Change-Id: I115e59e0b48306e9dd5d25d0a48ad58c79994607
PROD-related: PROD-29185
(cherry picked from commit e7c328594f1713aa29dc65069a7920fd5ff6c360)
diff --git a/elasticsearch/client/init.sls b/elasticsearch/client/init.sls
index 065bde1..b8ceb57 100644
--- a/elasticsearch/client/init.sls
+++ b/elasticsearch/client/init.sls
@@ -17,7 +17,7 @@
# Since bug in retry logic in salt (#49895) we need to use a workaround for now.
elasticsearch_check_cluster_status_before_creating_index_{{ index_name }}:
cmd.run:
- - name: curl -sf {{ client.server.host }}:{{ client.server.port }}/_cat/health | awk '{print $4}' | grep green
+ - name: curl -sfk {{ client.server.get("scheme", "http") }}://{{ client.server.host }}:{{ client.server.port }}/_cat/health | awk '{print $4}' | grep green
- retry:
attempts: 5
until: True
diff --git a/elasticsearch/client/update_index_templates.sls b/elasticsearch/client/update_index_templates.sls
index 605c064..0317e85 100644
--- a/elasticsearch/client/update_index_templates.sls
+++ b/elasticsearch/client/update_index_templates.sls
@@ -9,7 +9,7 @@
# Since bug in retry logic in salt (#49895) we need to use a workaround for now.
elasticsearch_check_cluster_status_before_index_template_upgrade_{{ index_name }}:
cmd.run:
- - name: curl -sf {{ client.server.host }}:{{ client.server.port }}/_cat/health | awk '{print $4}' | grep green
+ - name: curl -sfk {{ client.server.get("scheme", "http") }}://{{ client.server.host }}:{{ client.server.port }}/_cat/health | awk '{print $4}' | grep green
- retry:
attempts: 5
until: True
diff --git a/elasticsearch/map.jinja b/elasticsearch/map.jinja
index 0e5ae3c..09d76d5 100644
--- a/elasticsearch/map.jinja
+++ b/elasticsearch/map.jinja
@@ -27,6 +27,7 @@
server:
host: 127.0.0.1
port: 9200
+ scheme: http
binary_port: 9300
RedHat:
pkgs:
@@ -34,6 +35,7 @@
server:
host: 127.0.0.1
port: 9200
+ scheme: http
binary_port: 9300
{%- endload %}
diff --git a/elasticsearch/meta/salt.yml b/elasticsearch/meta/salt.yml
index 6cd9b82..a34e0db 100644
--- a/elasticsearch/meta/salt.yml
+++ b/elasticsearch/meta/salt.yml
@@ -3,5 +3,5 @@
elasticsearch:
{%- from "elasticsearch/map.jinja" import client with context %}
elasticsearch:
- host: {{client.server.host}}:{{client.server.port}}
+ host: {{ client.server.get("scheme", "http") }}://{{client.server.host}}:{{client.server.port}}
{%- endif %}