Skip to content

Instantly share code, notes, and snippets.

@UtahDave
Forked from dangarthwaite/elasticsearch.yml
Created December 5, 2012 17:06
Show Gist options
  • Save UtahDave/4217500 to your computer and use it in GitHub Desktop.
Save UtahDave/4217500 to your computer and use it in GitHub Desktop.
salt state for elasticsearch on squeeze
# vim: ft=yaml
cluster.name: {{ ES_CLUSTER_NAME }}
node.name: {{ grains['id'] }}
network.host: {{ salt['cmd.run']('awk \'/192.168/ {print $2}\' /etc/network/interfaces') }}
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.1.2", "192.168.1.3"]
# Run ElasticSearch as this user ID and group ID
#ES_USER=elasticsearch
#ES_GROUP=elasticsearch
# Heap Size (defaults to 256m min, 1g max)
ES_HEAP_SIZE={{ ES_HEAP_SIZE }}
# Heap new generation
#ES_HEAP_NEWSIZE=
# max direct memory
#ES_DIRECT_SIZE=
# Maximum number of open files, defaults to 65535.
#MAX_OPEN_FILES=65535
# Maximum locked memory size. Set to "unlimited" if you use the
# bootstrap.mlockall option in elasticsearch.yml. You must also set
# ES_HEAP_SIZE.
#MAX_LOCKED_MEMORY=unlimited
# ElasticSearch log directory
#LOG_DIR=/var/log/elasticsearch
# ElasticSearch data directory
#DATA_DIR=/var/lib/elasticsearch
# ElasticSearch work directory
#WORK_DIR=/tmp/elasticsearch
# ElasticSearch configuration directory
#CONF_DIR=/etc/elasticsearch
# ElasticSearch configuration file (elasticsearch.yml)
#CONF_FILE=/etc/elasticsearch/elasticsearch.yml
# Additional Java OPTS
#ES_JAVA_OPTS=
# vim: ft=yaml
{% set es_version = "0.19.11" %}
{% set es_deb = "elasticsearch-" + es_version + ".deb" %}
{% set es_heap_size = grains['mem_total'] * 0.5 %}
default-jre-headless:
pkg:
- installed
/var/cache/{{es_deb}}:
file.managed:
- source: salt://elasticsearch/{{es_deb}}
cmd.run:
- name: dpkg -i /var/cache/{{es_deb}}
- watch:
- file: /var/cache/{{es_deb}}
- require:
- pkg: default-jre-headless
- unless:
- dpkg -l elasticsearch | grep -q {{es_version}}
elasticsearch:
service.running:
- watch:
- file: /etc/elasticsearch/elasticsearch.yml
- file: /etc/default/elasticsearch
/etc/elasticsearch/elasticsearch.yml:
file.managed:
- source: salt://elasticsearch/elasticsearch.yml
- template: jinja
- require:
- file: /var/cache/{{es_deb}}
/etc/default/elasticsearch:
file.managed:
- source: salt://elasticsearch/etc-default-elasticsearch
- context:
ES_HEAP_SIZE: {{ es_heap_size | round | int }}m
- template: jinja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment