Merge pull request #595 from broferek/master
Set limitMEMLOCK for OS using systemd
This commit is contained in:
commit
410126465e
4 changed files with 21 additions and 1 deletions
2
files/systemd/elasticsearch_override.conf
Normal file
2
files/systemd/elasticsearch_override.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[Service]
|
||||||
|
LimitMEMLOCK=infinity
|
||||||
|
|
@ -24,10 +24,23 @@
|
||||||
template: src=elasticsearch.j2 dest={{ default_file }} mode=0644 force=yes
|
template: src=elasticsearch.j2 dest={{ default_file }} mode=0644 force=yes
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
|
|
||||||
|
#Copy the systemd specific file if systemd is installed
|
||||||
|
- when: use_system_d and m_lock_enabled
|
||||||
|
become: yes
|
||||||
|
block:
|
||||||
|
- name: Make sure destination dir exists
|
||||||
|
file: path={{ sysd_config_file | dirname }} state=directory mode=0755
|
||||||
|
|
||||||
|
- name: Copy specific ElasticSearch Systemd config file
|
||||||
|
ini_file: path={{ sysd_config_file }} section=Service option=LimitMEMLOCK value=infinity mode=0644
|
||||||
|
notify:
|
||||||
|
- reload systemd configuration
|
||||||
|
- restart elasticsearch
|
||||||
|
|
||||||
#Copy the logging.yml
|
#Copy the logging.yml
|
||||||
- name: Copy log4j2.properties File
|
- name: Copy log4j2.properties File
|
||||||
become: yes
|
become: yes
|
||||||
template: src={{es_config_log4j2}} dest={{ es_conf_dir }}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
template: src={{ es_config_log4j2 }} dest={{ es_conf_dir }}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
|
|
||||||
- name: Copy jvm.options File
|
- name: Copy jvm.options File
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,7 @@
|
||||||
|
|
||||||
- name: set fact m_lock_enabled
|
- name: set fact m_lock_enabled
|
||||||
set_fact: m_lock_enabled={{ es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True }}
|
set_fact: m_lock_enabled={{ es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True }}
|
||||||
|
|
||||||
|
- name: set fact use_system_d
|
||||||
|
set_fact: use_system_d={{(ansible_distribution == 'Debian' and ansible_distribution_version is version_compare('8', '>=')) or (ansible_distribution in ['RedHat','CentOS'] and ansible_distribution_version is version_compare('7', '>=')) or (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('15', '>=')) }}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
---
|
---
|
||||||
es_package_url: "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch"
|
es_package_url: "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch"
|
||||||
reserved_xpack_users: ["elastic","kibana","logstash_system"]
|
reserved_xpack_users: ["elastic","kibana","logstash_system"]
|
||||||
|
sysd_config_file: "/etc/systemd/system/elasticsearch.service.d/override.conf"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue