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
This commit is contained in:
Duncan Martin Walker 2020-05-14 15:51:57 +01:00
parent 9e3c52b855
commit 7f747d0875
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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 }}"