[WIP] Install elasticsearch-head plugin

This commit is contained in:
Jérémy Lecour 2016-11-16 11:58:35 +01:00 committed by Jérémy Lecour
parent 3400cb2f47
commit 6f60f2fb3c
5 changed files with 119 additions and 3 deletions

View file

@ -0,0 +1,22 @@
# elasticsearch-plugin-head
Install Head (Elasticsearch plugin).
## Tasks
Everything is in the `tasks/main.yml` file.
## Variables
* `elasticsearch_plugin_head_basedir`: base directory (default : `/var/www`) ;
* `elasticsearch_plugin_head_clone_name`: directory name for git clone.
## Misc
To use this plugin, you have to run the built-in webserver (using Grunt/NodeJS), or point a webserver to the path. More details here : https://github.com/mobz/elasticsearch-head#running-with-built-in-server
For example, to run the built-in server, with "www-data" user :
```
# sudo -u www-data bash -c 'cd /var/www/elasticsearch-head && grunt server'
```

View file

@ -0,0 +1,3 @@
elasticsearch_plugin_head_install_path: /var/www2/elasticsearch-head
elasticsearch_plugin_head_owner: "www-data"
elasticsearch_plugin_head_group: "www-data"

View file

@ -0,0 +1,6 @@
---
- name: restart elasticsearch
service:
name: elasticsearch
state: restarted

View file

@ -0,0 +1,83 @@
---
- 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: Head repository is check-out
git:
repo: "git://github.com/mobz/elasticsearch-head.git"
dest: "{{ elasticsearch_plugin_head_install_path }}"
clone: yes
tags:
- elasticsearch
- name: NPM packages for head are installed
npm:
path: "{{ elasticsearch_plugin_head_install_path }}"
tags:
- packages
- npm
- name: "Directory is owned by {{ elasticsearch_plugin_head_owner }}"
file:
path: "{{ elasticsearch_plugin_head_install_path }}"
owner: "{{ elasticsearch_plugin_head_owner }}"
group: "{{ elasticsearch_plugin_head_group }}"
state: directory
tags:
- elasticsearch
- 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

View file

@ -5,7 +5,8 @@
roles:
# - { role: apt-upgrade, apt_upgrade_mode: safe }
# - apt-upgrade
- apt-upgrade
- apt-backports
# - munin
# - monit
# - redis
@ -20,5 +21,6 @@
# nginx_private_htpasswd_absent: ["toto:dsfgdfsdf"]
# }
# - apache
# - apt-backports
- { role: elasticsearch, elasticsearch_custom_tmpdir: "/var/lib/elasticsearch/tmp" }
# - { role: elasticsearch, elasticsearch_custom_tmpdir: "/var/lib/elasticsearch/tmp" }
- elasticsearch
- elasticsearch-plugin-head