diff --git a/elasticsearch-plugin-head/README.md b/elasticsearch-plugin-head/README.md new file mode 100644 index 00000000..442550b5 --- /dev/null +++ b/elasticsearch-plugin-head/README.md @@ -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' +``` diff --git a/elasticsearch-plugin-head/defaults/main.yml b/elasticsearch-plugin-head/defaults/main.yml new file mode 100644 index 00000000..682aca99 --- /dev/null +++ b/elasticsearch-plugin-head/defaults/main.yml @@ -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" diff --git a/elasticsearch-plugin-head/handlers/main.yml b/elasticsearch-plugin-head/handlers/main.yml new file mode 100644 index 00000000..84a96121 --- /dev/null +++ b/elasticsearch-plugin-head/handlers/main.yml @@ -0,0 +1,6 @@ +--- + +- name: restart elasticsearch + service: + name: elasticsearch + state: restarted diff --git a/elasticsearch-plugin-head/tasks/main.yml b/elasticsearch-plugin-head/tasks/main.yml new file mode 100644 index 00000000..4aa82c2c --- /dev/null +++ b/elasticsearch-plugin-head/tasks/main.yml @@ -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 diff --git a/vagrant.yml b/vagrant.yml index 89285a70..7bf14de1 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -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