Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 4420df6

Browse files
Use a template to write override.conf file (#697)
1 parent 16fad55 commit 4420df6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tasks/elasticsearch-config.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
notify: restart elasticsearch
6161

6262
#Copy the systemd specific file if systemd is installed
63-
- when: use_system_d and m_lock_enabled
63+
- when: use_system_d and (m_lock_enabled or es_max_open_files is defined)
6464
become: yes
6565
block:
6666
- name: Make sure destination dir exists
@@ -70,12 +70,13 @@
7070
mode: "755"
7171

7272
- name: Copy specific ElasticSearch Systemd config file
73-
ini_file:
74-
path: "{{ sysd_config_file }}"
75-
section: Service
76-
option: LimitMEMLOCK
77-
value: infinity
73+
template:
74+
src: "override.conf.j2"
75+
dest: "{{ sysd_config_file }}"
76+
owner: root
77+
group: "{{ es_group }}"
7878
mode: "644"
79+
force: yes
7980
notify:
8081
- reload systemd configuration
8182
- restart elasticsearch

templates/override.conf.j2

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
{% if m_lock_enabled %}
3+
LimitMEMLOCK = infinity
4+
{% endif %}
5+
{% if es_max_open_files is defined %}
6+
LimitNOFILE = {{ es_max_open_files }}
7+
{% endif %}

0 commit comments

Comments
 (0)