Skip to content

Instantly share code, notes, and snippets.

@viq
Created May 9, 2014 17:14
Show Gist options
  • Save viq/67c0528c31eb8e4b64eb to your computer and use it in GitHub Desktop.
Save viq/67c0528c31eb8e4b64eb to your computer and use it in GitHub Desktop.
es-requirements:
pkg.installed:
- pkgs:
- {{ salt['pillar.get']('packages:jre7') }}
elasticsearch:
pkgrepo.managed:
- humanname: ElasticSearch repository for {{ salt['pillar.get']('logstash:es_ver') }}.x packages
{% if grains['os_family'] == 'RedHat' %}
- name: elasticsearch-{{ salt['pillar.get']('logstash:es_ver') }}
- baseurl: http://packages.elasticsearch.org/elasticsearch/{{ salt['pillar.get']('logstash:es_ver') }}/centos
- gpgcheck: 1
- gpgkey: http://packages.elasticsearch.org/GPG-KEY-elasticsearch
{% elif grains['os_family'] == 'Debian' %}
- name: deb http://packages.elasticsearch.org/elasticsearch/{{ salt['pillar.get']('logstash:es_ver') }}/debian stable main
- key_url: http://packages.elasticsearch.org/GPG-KEY-elasticsearch
{% endif %}
pkg.latest:
- require:
- pkg: es-requirements
- pkgrepo: elasticsearch
service:
- running
- enable: True
- watch:
- file: /etc/elasticsearch/elasticsearch.yml
- file: /etc/security/limits.conf
- file: elasticsearch-config
- pkg: elasticsearch
elasticsearch-config:
file:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/sysconfig/elasticsearch
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/default/elasticsearch
{% endif %}
- replace
- pattern: '#ES_HEAP_SIZE=2g'
- repl: ES_HEAP_SIZE={{ (grains['mem_total']/2)|round|int }}m
- require:
- pkg: elasticsearch
/etc/elasticsearch/elasticsearch.yml:
file:
- unless: grep "ElasticSearch Configuration Example" /etc/elasticsearch/elasticsearch.yml
- managed
- source: salt://logstash/elasticsearch.yml
- template: jinja
- require:
- pkg: elasticsearch
/usr/share/elasticsearch/bin/plugin -install karmi/elasticsearch-paramedic:
cmd:
- run
- unless: curl -s http://localhost:9200/_plugin/paramedic/index.html | grep Paramedic
- require:
- pkg: elasticsearch
/etc/pam.d/su:
file:
- replace
- pattern: '# session required pam_limits.so'
- repl: 'session required pam_limits.so'
/etc/security/limits.conf:
file:
- append
- text:
- elasticsearch soft nofile 60000
- elasticsearch hard nofile 60000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment