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

85 lines
1.8 KiB
YAML

---
- name: APT https transport is enabled
apt:
name: apt-transport-https
state: installed
tags:
- system
- packages
- name: Node GPG key is installed
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
tags:
- system
- packages
- npm
- name: Node sources list is available
apt_repository:
repo: "deb https://deb.nodesource.com/node_6.x jessie main"
state: present
tags:
- system
- packages
- npm
- name: Node is installed
apt:
name: nodejs
update_cache: yes
state: installed
tags:
- packages
- npm
- 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