-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.yml
53 lines (46 loc) · 2.86 KB
/
site.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
- hosts: elasticsearch
become: yes
vars:
elasticsearch_user: elasticsearch
elasticsearch_max_open_files: 65535
elasticsearch_heap_size: 16g
elasticsearch_data_dirs:
- /mnt/vol-1/es/indexes
elasticsearch_log_dir: /mnt/vol-1/es/log
elasticsearch_interface: ens4
#elasticsearch_max_locked_memory:
roles:
- ansible-java8-oracle
tasks:
- name: Remove Swap Space
lineinfile: dest=/etc/fstab state=absent regexp=" swap "
- name: Set Heap size
copy:
dest: /etc/profile.d/elasticsearch.sh
content: |
export ES_HEAP_SIZE={{ elasticsearch_heap_size }}
- apt: pkg=apt-transport-https state=installed
- apt_repository: repo='deb https://artifacts.elastic.co/packages/5.x/apt stable main' state=present
- apt_key: url=https://artifacts.elastic.co/GPG-KEY-elasticsearch state=present
- apt: pkg=elasticsearch state=installed update_cache=yes allow_unauthenticated=yes
- name: elasticsearch-configure | Set limits pt. 1
lineinfile: dest=/etc/security/limits.conf regexp='^{{elasticsearch_user}} - nofile {{elasticsearch_max_open_files}}' insertafter=EOF line='{{elasticsearch_user}} - nofile {{elasticsearch_max_open_files}}'
when: elasticsearch_max_open_files is defined
- name: elasticsearch-configure | Set limits pt. 2
lineinfile: dest=/etc/security/limits.conf regexp='^{{elasticsearch_user}} - memlock {{elasticsearch_max_locked_memory}}' insertafter=EOF line='{{elasticsearch_user}} - memlock {{elasticsearch_max_locked_memory}}'
when: elasticsearch_max_locked_memory is defined
- lineinfile: dest=/etc/pam.d/su regexp='^session required pam_limits.so' insertafter=EOF line='session required pam_limits.so'
- lineinfile: dest=/etc/pam.d/common-session regexp='^session required pam_limits.so' insertafter=EOF line='session required pam_limits.so'
when: ansible_os_family == 'Debian'
- lineinfile: dest=/etc/pam.d/common-session-noninteractive regexp='^session required pam_limits.so' insertafter=EOF line='session required pam_limits.so'
when: ansible_os_family == 'Debian'
- lineinfile: dest=/etc/pam.d/sudo regexp='^session required pam_limits.so' insertafter=EOF line='session required pam_limits.so'
# - lineinfile: dest=/etc/init.d/elasticsearch regexp='^(DAEMON_OPTS=".*-Des.max-open-files=true")$' insertafter='^(DAEMON_OPTS=".*CONF_DIR")$' line='DAEMON_OPTS="$DAEMON_OPTS -Des.max-open-files=true"'
- template: src=elasticsearch.yml.j2 dest=/etc/elasticsearch/elasticsearch.yml
#- template: src=logging.yml.j2 dest=/etc/elasticsearch/logging.yml
# - command: bin/plugin install {{item}}
# with_items:
# - delete-by-query
# args:
# chdir: /usr/share/elasticsearch
- service: name=elasticsearch enabled=yes state=restarted