ansible-roles/elasticsearch-plugin-head/tasks/main.yml

49 lines
1.2 KiB
YAML

---
- name: "User {{ elasticsearch_plugin_head_owner }} is present"
user:
name: "{{ elasticsearch_plugin_head_owner }}"
home: "{{ elasticsearch_plugin_head_home }}"
createhome: yes
system: yes
shell: /bin/false
- block:
- name: Head repository is check-out
git:
repo: "git://github.com/mobz/elasticsearch-head.git"
dest: "{{ elasticsearch_plugin_head_clone_dir }}"
clone: yes
tags:
- packages
- name: NPM packages for head are installed
npm:
path: "{{ elasticsearch_plugin_head_clone_dir }}"
tags:
- packages
- npm
become_user: "{{ elasticsearch_plugin_head_owner }}"
- 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