2016-11-15 18:23:53 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Check if /tmp is noexec
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: "cat /etc/fstab | grep -E \" +/tmp\" | grep noexec"
|
2016-11-15 18:23:53 +01:00
|
|
|
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:
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.set_fact:
|
2021-05-09 23:06:42 +02:00
|
|
|
_elasticsearch_custom_tmpdir: "{{ elasticsearch_custom_tmpdir | default(elasticsearch_default_tmpdir, True) | mandatory }}"
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
|
|
|
|
|
|
|
- name: "Create {{ _elasticsearch_custom_tmpdir }}"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.file:
|
2021-05-09 23:06:42 +02:00
|
|
|
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)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2022-02-23 10:14:43 +01:00
|
|
|
dest: /etc/elasticsearch/jvm.options.d/evolinux.options
|
2021-05-09 23:06:42 +02:00
|
|
|
line: "-Djava.io.tmpdir={{ _elasticsearch_custom_tmpdir }}"
|
2019-12-31 16:56:03 +01:00
|
|
|
regexp: "^-Djava.io.tmpdir="
|
2022-02-07 15:17:23 +01:00
|
|
|
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
|
2020-02-25 10:45:35 +01:00
|
|
|
when: elastic_stack_version is version('6', '<')
|
2018-05-16 12:15:04 +02:00
|
|
|
|
2019-12-31 16:56:03 +01:00
|
|
|
- name: check if ES_TMPDIR is available (>= 6.x)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2019-12-31 16:56:03 +01:00
|
|
|
dest: /etc/default/elasticsearch
|
2021-05-09 23:06:42 +02:00
|
|
|
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
|
2020-02-25 10:45:35 +01:00
|
|
|
when: elastic_stack_version is version('6', '>=')
|
2018-02-07 17:36:04 +01:00
|
|
|
|
2022-02-07 15:17:23 +01:00
|
|
|
# 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)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2019-12-31 16:56:03 +01:00
|
|
|
dest: /etc/elasticsearch/jvm.options
|
|
|
|
line: "-Djava.io.tmpdir=${ES_TMPDIR}"
|
|
|
|
regexp: "^-Djava.io.tmpdir="
|
|
|
|
insertafter: "## JVM configuration"
|
|
|
|
notify:
|
|
|
|
- restart elasticsearch
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
2020-02-25 10:45:35 +01:00
|
|
|
when: elastic_stack_version is version('6', '>=')
|
2021-05-09 23:06:42 +02:00
|
|
|
when: (elasticsearch_custom_tmpdir is not none and elasticsearch_custom_tmpdir | length > 0) or fstab_tmp_noexec.rc == 0
|