2016-11-16 11:58:35 +01:00
|
|
|
---
|
|
|
|
|
2016-11-21 17:30:25 +01:00
|
|
|
- name: "User {{ elasticsearch_plugin_head_owner }} is present"
|
|
|
|
user:
|
|
|
|
name: "{{ elasticsearch_plugin_head_owner }}"
|
|
|
|
home: "{{ elasticsearch_plugin_head_home }}"
|
|
|
|
createhome: yes
|
|
|
|
system: yes
|
2017-10-11 17:58:03 +02:00
|
|
|
shell: /bin/false
|
2016-11-16 11:58:35 +01:00
|
|
|
|
2016-11-21 17:30:25 +01:00
|
|
|
- block:
|
2017-05-23 15:09:46 +02:00
|
|
|
- name: Head repository is checked-out
|
2016-11-21 17:30:25 +01:00
|
|
|
git:
|
2017-10-09 16:36:03 +02:00
|
|
|
repo: "https://github.com/mobz/elasticsearch-head.git"
|
2016-11-21 17:30:25 +01:00
|
|
|
dest: "{{ elasticsearch_plugin_head_clone_dir }}"
|
|
|
|
clone: yes
|
|
|
|
tags:
|
|
|
|
- packages
|
2016-11-16 11:58:35 +01:00
|
|
|
|
2017-05-23 15:09:46 +02:00
|
|
|
- name: Create tmpdir
|
|
|
|
file:
|
|
|
|
dest: "{{ elasticsearch_plugin_head_tmp_dir }}"
|
|
|
|
state: directory
|
|
|
|
|
2016-11-21 17:30:25 +01:00
|
|
|
- name: NPM packages for head are installed
|
|
|
|
npm:
|
|
|
|
path: "{{ elasticsearch_plugin_head_clone_dir }}"
|
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
- npm
|
2017-05-23 15:09:46 +02:00
|
|
|
environment:
|
|
|
|
TMPDIR: "{{ elasticsearch_plugin_head_tmp_dir }}"
|
2016-11-21 17:30:25 +01:00
|
|
|
become_user: "{{ elasticsearch_plugin_head_owner }}"
|
2018-04-04 23:22:17 +02:00
|
|
|
become: yes
|
2016-11-16 11:58:35 +01:00
|
|
|
|
|
|
|
- name: Elasticsearch HTTP/CORS are enabled
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
line: "http.cors.enabled: true"
|
|
|
|
regexp: "^http.cors.enabled:"
|
|
|
|
insertafter: EOF
|
|
|
|
notify:
|
|
|
|
- restart elasticsearch
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
|
|
|
|
|
|
|
- name: Elasticsearch HTTP/CORS accepts all origins
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
line: "http.cors.allow-origin: \"*\""
|
|
|
|
regexp: "^http.cors.allow-origin:"
|
|
|
|
insertafter: "http.cors.enabled"
|
|
|
|
notify:
|
|
|
|
- restart elasticsearch
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
2017-10-09 17:45:51 +02:00
|
|
|
|
|
|
|
- name: Install systemd unit
|
|
|
|
template:
|
|
|
|
src: elasticsearch-head.service.j2
|
|
|
|
dest: /etc/systemd/system/elasticsearch-head.service
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
|
|
|
- systemd
|
|
|
|
|
|
|
|
- name: Enable systemd unit
|
|
|
|
systemd:
|
|
|
|
name: elasticsearch-head
|
|
|
|
daemon_reload: yes
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
tags:
|
|
|
|
- elasticsearch
|
|
|
|
- systemd
|