William-Yeh.elasticsearch

williamyeh.elasticsearch for Ansible Galaxy

============

Circle CI Build Status

Summary

Role name in Ansible Galaxy: williamyeh.elasticsearch

This Ansible role has the following features for Elasticsearch:

  • Installs Elasticsearch.
  • Allows you to set the heap size and use G1GC for JVM if needed.
  • Installs both standard and third-party plugins.
  • Basic configuration (real configuration should be managed with your own template files; see Usage section below).

Role Variables

Mandatory variables

You must define these variables in your playbook:

elasticsearch_version

Optional variables

Configuration files that you can install (using Ansible’s template system):

# Configuration file (usually elasticsearch.yml) to be copied as is,
# relative to `playbook_dir`;
elasticsearch_conf_copy

# Configuration file (usually elasticsearch.yml.j2) to be installed
# using Ansible’s template system;
elasticsearch_conf_template

Plugins to install:

# List of plugins to install from elasticsearch.org.
# See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html
elasticsearch_plugins

# List of other plugins to install.
# Each item must include:
#  - "name": the plugin name without the ".jar".
#  - "url": the link to the jar file.
elasticsearch_other_plugins

User-defined defaults:

# Use G1GC for JVM?
elasticsearch_use_g1gc: false

# JVM heap size for Elasticsearch
elasticsearch_heap_size

Handlers

  • restart elasticsearch
  • stop elasticsearch

Usage

Step 1: Add Role

Add the role name williamyeh.elasticsearch to your playbook.

Step 2: Add Variables

Set the variables in your playbook.

Simple example:

---
# file: simple-playbook.yml

- hosts: all

  roles:
    - williamyeh.oracle-java
    - williamyeh.elasticsearch

  vars:
    elasticsearch_version: 1.6.0

Step 3: Adjust JVM Memory, if Needed

---
- hosts: all

  roles:
    - williamyeh.oracle-java
    - williamyeh.elasticsearch

  vars:
    elasticsearch_version: 1.4.2

    elasticsearch_use_g1gc: true
    elasticsearch_heap_size: 6g

Step 4: Copy Your Config File, Install Plugins, etc., if Needed

More detailed example:

---
# file: complex-playbook.yml

- hosts: all

  roles:
    - williamyeh.oracle-java
    - williamyeh.elasticsearch

  vars:
    elasticsearch_version: 1.4.2

    elasticsearch_plugins:
      - elasticsearch/marvel/latest
      - lmenezes/elasticsearch-kopf

    elasticsearch_other_plugins:
      - name: analysis-ik
        url:  https://github.com/medcl/elasticsearch-rtf/raw/master/plugins/analysis-ik/elasticsearch-analysis-ik-1.2.6.jar
        memo: https://github.com/medcl/elasticsearch-analysis-ik

    # Copy as is
    elasticsearch_conf_copy: "files/elasticsearch.yml"

    # Copy using Ansible’s template system
    # elasticsearch_conf_template: "templates/elasticsearch.yml.j2"

Dependencies

Make sure your target hosts have JDK installed beforehand. You can use williamyeh.oracle-java or any other relevant roles available in Ansible Galaxy.

License

This project is licensed under the MIT License. For details, check the LICENSE file.

History

None.

Informazioni sul progetto

Install Elasticsearch

Installa
ansible-galaxy install William-Yeh.elasticsearch
Licenza
mit
Download
190
Proprietario