From 1214e42b85f5f0e32fe6938af6a5be157bc8abb8 Mon Sep 17 00:00:00 2001 From: Duncan Martin Walker Date: Wed, 5 Feb 2020 16:44:53 +0000 Subject: [PATCH] Explicitly use Elasticsearch data node for ILM index update When installing/configuring beats, it may be the case that elastic-logstash nodes are not running Elasticsearch directly, and so can't update the ILM config accordingly. This commit explicitly delegates the ILM config update to an elasticsearch data node, in order that this will always be possible. As Elasticsearch and logstash are by default installed together, the default behaviour is unchanged. Change-Id: I6833585b9a02eddc3c9a1179e487cdeaefa30ac2 --- elk_metrics_7x/roles/elastic_ilm/defaults/main.yml | 2 ++ elk_metrics_7x/roles/elastic_ilm/tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml b/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml index 46cde581..63924b61 100644 --- a/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml +++ b/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml @@ -16,3 +16,5 @@ default_ilm_policy: delete: {} default_ilm_policy_filename: "default-ilm-policy.json" default_ilm_policy_file_location: "/tmp" + +elastic_beat_no_proxy: "{{ hostvars[groups['elastic-logstash'][0]]['ansible_host'] }}" diff --git a/elk_metrics_7x/roles/elastic_ilm/tasks/main.yml b/elk_metrics_7x/roles/elastic_ilm/tasks/main.yml index 0bdc3c42..466dba99 100644 --- a/elk_metrics_7x/roles/elastic_ilm/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_ilm/tasks/main.yml @@ -5,8 +5,8 @@ - block: - name: Update policy and template when not upgrading include_tasks: "elastic_ilm_update_policy.yml" - delegate_to: "{{ groups['elastic-logstash'][0] }}" + delegate_to: "{{ elasticsearch_data_node_details[0] | regex_replace(':' ~ elastic_port,'') }}" environment: - no_proxy: "{{ hostvars[groups['elastic-logstash'][0]]['ansible_host'] }},127.0.0.1" + no_proxy: "{{ elastic_beat_no_proxy }},127.0.0.1" run_once: True when: (elk_package_state | default('present')) != "latest"