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
|
|
|
|
|
|
|
- block:
|
2016-11-21 17:29:44 +01:00
|
|
|
- name: "Create {{ elasticsearch_custom_tmpdir or elasticsearch_default_tmpdir | mandatory }}"
|
2016-11-15 18:23:53 +01:00
|
|
|
file:
|
2016-11-21 17:29:44 +01:00
|
|
|
path: "{{ elasticsearch_custom_tmpdir or elasticsearch_default_tmpdir | mandatory }}"
|
2016-11-15 18:23:53 +01:00
|
|
|
owner: elasticsearch
|
|
|
|
group: elasticsearch
|
2017-03-23 16:59:43 +01:00
|
|
|
mode: "0755"
|
2016-11-15 18:23:53 +01:00
|
|
|
state: directory
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
|
|
|
|
2018-05-16 12:15:04 +02:00
|
|
|
- name: change JVM tmpdir (< 6.x)
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/elasticsearch/jvm.options
|
|
|
|
line: "-Djava.io.tmpdir={{ elasticsearch_custom_tmpdir or elasticsearch_default_tmpdir | mandatory }}"
|
|
|
|
regexp: "^-Djava.io.tmpdir="
|
|
|
|
insertafter: "## JVM configuration"
|
|
|
|
notify:
|
|
|
|
- restart elasticsearch
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
|
|
|
when: elastic_stack_version | version_compare('6', '<')
|
|
|
|
|
|
|
|
- name: check if ES_TMPDIR is available (>= 6.x)
|
2018-02-07 17:36:04 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/default/elasticsearch
|
|
|
|
line: "ES_TMPDIR={{ elasticsearch_custom_tmpdir or elasticsearch_default_tmpdir | mandatory }}"
|
|
|
|
regexp: "^ES_TMPDIR="
|
|
|
|
insertafter: "JAVA_HOME"
|
|
|
|
notify:
|
|
|
|
- restart elasticsearch
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
2018-05-16 12:15:04 +02:00
|
|
|
when: elastic_stack_version | version_compare('6', '>=')
|
2018-02-07 17:36:04 +01:00
|
|
|
|
2018-05-16 12:15:04 +02:00
|
|
|
- name: change JVM tmpdir (>= 6.x)
|
2016-11-15 18:23:53 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/elasticsearch/jvm.options
|
2018-02-07 17:36:04 +01:00
|
|
|
line: "-Djava.io.tmpdir=${ES_TMPDIR}"
|
2016-11-15 18:23:53 +01:00
|
|
|
regexp: "^-Djava.io.tmpdir="
|
|
|
|
insertafter: "## JVM configuration"
|
|
|
|
notify:
|
|
|
|
- restart elasticsearch
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
2018-05-16 12:15:04 +02:00
|
|
|
when: elastic_stack_version | version_compare('6', '>=')
|
2017-11-14 11:05:54 +01:00
|
|
|
when: (elasticsearch_custom_tmpdir != '' and elasticsearch_custom_tmpdir != None) or fstab_tmp_noexec | success
|