ansible/roles/elasticsearch/tasks/custom-jars.yml
---
# Install Custom JARs
#
# Custom jars are made available to the Elasticsearch classpath by being downloaded into the elasticsearch_home_dir/lib folder.
# An example of a custom jar can include a custom Lucene Similarity Provider. You will need to define an array called
# 'elasticsearch_custom_jars' in your playbook or inventory, such that:
#
# elasticsearch_custom_jars:
# - { uri: '<URL where JAR can be downloaded from: required>', filename: '<alternative name for final JAR if different from file downladed: leave blank to use same filename>', user: '<BASIC auth username: leave blank of not needed>', passwd: '<BASIC auth password: leave blank of not needed>' }
# - ...
# Loop though elasticsearch_custom_jars and install them
- name: Installing Custom JARs
action: >
get_url url={{ item.uri }}
url_username={{ item.user }} url_password={{ item.passwd }} dest="{{ elasticsearch_home_dir }}/lib/{{ item.filename }}"
with_items: elasticsearch_custom_jars
# Fix permissions
- file: >
path="{{ elasticsearch_home_dir }}/lib" state=directory
owner={{ elasticsearch_user }} group={{ elasticsearch_group }}
recurse=yes