From 7f747d0875b788d4c45d46b42693305aa9587f26 Mon Sep 17 00:00:00 2001 From: Duncan Martin Walker Date: Thu, 14 May 2020 15:51:57 +0100 Subject: [PATCH] Enable plugin install and removal from mirrors Elasticsearch does not currently include plugins in their packages, and hosts them as .zip files from https://artifacts.elastic.co/downloads/. These can be installed from a mirror by changing the elastichsearch-plugin call to reference a hosted file URI. However, the plugin removal stage uses the plugin name, so both name and URI have to be known for the remove and reinstall plugin tasks in the elasticsearch role to work. This commit changes the plugin data format to add an optional remote field so that a URI can be optionally used Change-Id: I2c366cbeb9912c3aba09ecc5e174baa50de28a1f --- elk_metrics_7x/roles/elasticsearch/defaults/main.yml | 8 +++++++- .../roles/elasticsearch/tasks/elasticsearch_plugins.yml | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/elk_metrics_7x/roles/elasticsearch/defaults/main.yml b/elk_metrics_7x/roles/elasticsearch/defaults/main.yml index 7579d506..87e799e5 100644 --- a/elk_metrics_7x/roles/elasticsearch/defaults/main.yml +++ b/elk_metrics_7x/roles/elasticsearch/defaults/main.yml @@ -25,8 +25,14 @@ elastic_memory_lock: true # Elasticsearch plugin list. These plugins will be re-installed whenever the # playbooks are executed, which ensures the plugins are always upgraded. +# To install plugins from a mirror, the remote attribute can be specified +# with the uri of the plugin zip file. +# elastic_plugins: +# - ingest-attachment: +# remote: +# elastic_plugins: - - ingest-attachment + - name: ingest-attachment # Set the logstash search heap size. If this option is undefined the value will # be derived automatically using 1/4 of the available RAM for logstash and 1/2 diff --git a/elk_metrics_7x/roles/elasticsearch/tasks/elasticsearch_plugins.yml b/elk_metrics_7x/roles/elasticsearch/tasks/elasticsearch_plugins.yml index 5d4bd2df..c0a11fce 100644 --- a/elk_metrics_7x/roles/elasticsearch/tasks/elasticsearch_plugins.yml +++ b/elk_metrics_7x/roles/elasticsearch/tasks/elasticsearch_plugins.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Remove plugins - command: "/usr/share/elasticsearch/bin/elasticsearch-plugin remove --verbose {{ item }}" + command: "/usr/share/elasticsearch/bin/elasticsearch-plugin remove --verbose {{ item.name }}" failed_when: false changed_when: - remove_plugin.rc == 0 @@ -22,5 +22,5 @@ with_items: "{{ elastic_plugins }}" - name: Install plugins - command: "/usr/share/elasticsearch/bin/elasticsearch-plugin install --batch --verbose {{ item }}" + command: "/usr/share/elasticsearch/bin/elasticsearch-plugin install --batch --verbose {{ item.remote | default(item.name) }}" with_items: "{{ elastic_plugins }}"