72 lines
1.7 KiB
YAML
72 lines
1.7 KiB
YAML
---
|
|
- name: setup elastic group
|
|
group:
|
|
name: "{{ elastic_grp }}"
|
|
state: "present"
|
|
|
|
- name: setup elastic user
|
|
user:
|
|
name: "{{ elastic_usr }}"
|
|
home: "{{ elastic_home }}"
|
|
group: "{{ elastic_grp }}"
|
|
groups:
|
|
- "{{ elastic_grp }}"
|
|
comment: Virtual Elastic User
|
|
shell: /bin/bash
|
|
state: present
|
|
system: yes
|
|
|
|
- name: setup ElasticSearch directories
|
|
file:
|
|
state: directory
|
|
path: "{{ item }}"
|
|
owner: "{{ elastic_usr }}"
|
|
group: "{{ elastic_grp }}"
|
|
mode: 0750
|
|
loop:
|
|
- "{{ elastic_path }}"
|
|
- "{{ elastic_home }}"
|
|
- "{{ elastic_conf }}"
|
|
- "{{ elastic_data_location }}"
|
|
- "{{ elastic_logs_location }}"
|
|
|
|
- name: download ElasticSearch
|
|
unarchive:
|
|
src: "{{ elastic_source }}/elasticsearch-{{ elastic_version }}-{{ elastic_platform_suffix }}.tar.gz"
|
|
dest: "{{ elastic_path }}"
|
|
creates: "{{ elastic_inst }}"
|
|
remote_src: true
|
|
owner: "{{ elastic_usr }}"
|
|
group: "{{ elastic_grp }}"
|
|
mode: 0755
|
|
|
|
- name: configure ElasticSearch
|
|
template:
|
|
src: "opt/elastic/home/config/{{ item }}.j2"
|
|
dest: "{{ elastic_conf }}/{{ item }}"
|
|
owner: "{{ elastic_usr }}"
|
|
group: "{{ elastic_grp }}"
|
|
mode: 0644
|
|
loop:
|
|
- elasticsearch.yml
|
|
- jvm.options
|
|
|
|
|
|
- name: setup generic ElasticSearch link
|
|
file:
|
|
state: link
|
|
src: "{{ elastic_inst }}"
|
|
dest: "{{ elastic_link }}"
|
|
|
|
- name: setup ElasticSearch systemd unit
|
|
template:
|
|
src: etc/systemd/system/elasticsearch.service.j2
|
|
dest: /etc/systemd/system/elasticsearch.service
|
|
notify: restart elasticsearch
|
|
|
|
- name: enable elasticsearch systemd unit
|
|
systemd:
|
|
name: elasticsearch
|
|
enabled: yes
|
|
daemon_reload: yes
|
|
state: started |