ansible-roles/elasticsearch/tasks/tmpdir.yml

67 lines
2.1 KiB
YAML
Raw Normal View History

2016-11-15 18:23:53 +01:00
---
- name: Check if /tmp is noexec
shell: "cat /etc/fstab | grep -E \" +/tmp\" | grep noexec"
register: fstab_tmp_noexec
failed_when: False
changed_when: False
2017-03-24 14:15:09 +01:00
check_mode: no
2016-11-15 18:23:53 +01:00
2019-12-31 16:56:03 +01:00
- name: Tmpdir is moved to custom path
block:
- set_fact:
_elasticsearch_custom_tmpdir: "{{ elasticsearch_custom_tmpdir | default(elasticsearch_default_tmpdir, True) | mandatory }}"
tags:
- elasticsearch
- name: "Create {{ _elasticsearch_custom_tmpdir }}"
2019-12-31 16:56:03 +01:00
file:
path: "{{ _elasticsearch_custom_tmpdir }}"
2019-12-31 16:56:03 +01:00
owner: elasticsearch
group: elasticsearch
mode: "0755"
state: directory
tags:
- elasticsearch
2016-11-15 18:23:53 +01:00
2019-12-31 16:56:03 +01:00
- name: change JVM tmpdir (< 6.x)
lineinfile:
dest: /etc/elasticsearch/jvm.options.d/evolinux.options
line: "-Djava.io.tmpdir={{ _elasticsearch_custom_tmpdir }}"
2019-12-31 16:56:03 +01:00
regexp: "^-Djava.io.tmpdir="
create: yes
owner: root
group: elasticsearch
2022-06-08 15:38:21 +02:00
mode: "0640"
2019-12-31 16:56:03 +01:00
notify:
- restart elasticsearch
tags:
- elasticsearch
when: elastic_stack_version is version('6', '<')
2019-12-31 16:56:03 +01:00
- name: check if ES_TMPDIR is available (>= 6.x)
lineinfile:
dest: /etc/default/elasticsearch
line: "ES_TMPDIR={{ _elasticsearch_custom_tmpdir }}"
2019-12-31 16:56:03 +01:00
regexp: "^ES_TMPDIR="
insertafter: "JAVA_HOME"
notify:
- restart elasticsearch
tags:
- elasticsearch
when: elastic_stack_version is version('6', '>=')
# Note : Should not do any changes as -Djava.io.tmpdir=${ES_TMPDIR} is already here in the default config.
2019-12-31 16:56:03 +01:00
- name: change JVM tmpdir (>= 6.x)
lineinfile:
dest: /etc/elasticsearch/jvm.options
line: "-Djava.io.tmpdir=${ES_TMPDIR}"
regexp: "^-Djava.io.tmpdir="
insertafter: "## JVM configuration"
notify:
- restart elasticsearch
tags:
- elasticsearch
when: elastic_stack_version is version('6', '>=')
when: (elasticsearch_custom_tmpdir is not none and elasticsearch_custom_tmpdir | length > 0) or fstab_tmp_noexec.rc == 0