feat: new option to set heap size

This commit is contained in:
Adrien Waksberg 2019-11-21 13:06:01 +01:00
parent 8f8d6cdb42
commit dac6a51c1d
6 changed files with 22 additions and 0 deletions

View file

@ -5,6 +5,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
## [Unreleased]
### Added
- new option to set heap size
## v1.0.0 - 2019-09-05
### Added

View file

@ -12,6 +12,7 @@ Install and configure Elasticsearch
## Role variables
* `elasticsearch_heap_size` - set the heap size (default: `1g`)
* `elasticsearch_config` - hash with the configuration (see [elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html))
```

View file

@ -1,4 +1,5 @@
---
elasticsearch_heap_size: 1g
elasticsearch_config: {}
elasticsearch_default_config:
path.data: /var/lib/elasticsearch

View file

@ -28,6 +28,17 @@
until: result is succeeded
tags: elasticsearch
- name: set heap size
lineinfile:
path: /etc/elasticsearch/jvm.options
regexp: '^-{{ item }}'
line: '-{{ item }}{{ elasticsearch_heap_size }}'
loop:
- Xms
- Xmx
notify: restart elasticsearch
tags: elasticsearch
- name: copy config file
copy:
content: '{{ elasticsearch_full_config|to_yaml }}'

View file

@ -2,6 +2,7 @@
- hosts: localhost
connection: local
vars:
elasticsearch_heap_size: 512m
roles:
- ansible-role-elasticsearch

View file

@ -29,3 +29,7 @@ end
describe port(9200) do
it { should be_listening }
end
describe command('ps faux | grep elasticsearch') do
its(:stdout) { should contain('-Xms512m -Xmx512m') }
end