summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/ansible/roles/elasticsearch/tasks/main.yml
blob: c204134368a15d6d5a9d747bc26a9329dca3b9af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---

- name: import ppa:webupd8team/java gpg key
  apt_key: >
    id=EEA14886
    keyserver=keyserver.ubuntu.com
    state=present

- name: add ppa:webupd8team/java repository
  apt_repository: >
    repo="deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main"
    state=present
    update_cache=yes

- name: accept oracle license
  shell: >
    echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections

- name: install java
  apt: >
    force=yes
    name={{ item }}
    state=present
    update_cache=no
  with_items:
    - oracle-java7-installer
    - oracle-java7-set-default

- name: import elasticsearch gpg key
  apt_key: >
    id=D88E42B4
    url=https://packages.elasticsearch.org/GPG-KEY-elasticsearch
    state=present

- name: add elasticsearch repository
  apt_repository: >
    repo="deb http://packages.elasticsearch.org/elasticsearch/{{ ES_SHORT_VER }}/debian stable main"
    state=present
    update_cache=yes

- name: install elasticsearch
  apt: >
    force=yes
    name=elasticsearch={{ ES_VER }}
    state=present
    update_cache=no

- name: install image plugin
  command: >
    creates=/usr/share/elasticsearch/plugins/image
    /usr/share/elasticsearch/bin/plugin --url https://github.com/SibaTokyo/elasticsearch-image/releases/download/{{ ES_IMAGE_PLUGIN_VER }}/elasticsearch-image-{{ ES_IMAGE_PLUGIN_VER }}.zip -install image

- name: install mapper-attachments plugin
  command: >
    creates=/usr/share/elasticsearch/plugins/mapper-attachments
    /usr/share/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/{{ ES_MAPPER_ATTACHMENTS_VER }}

- name: install geocluster-facet plugin
  command: >
    creates=/usr/share/elasticsearch/plugins/geocluster-facet
    /usr/share/elasticsearch/bin/plugin -install geocluster-facet --url https://github.com/zenobase/geocluster-facet/releases/download/{{ ES_GEOCLUSTER_FACET_VER }}/geocluster-facet-{{ ES_GEOCLUSTER_FACET_VER }}.jar

- name: install transport-thrift plugin
  command: >
    creates=/usr/share/elasticsearch/plugins/transport-thrift
    /usr/share/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-transport-thrift/{{ ES_TRANSPORT_THRIFT_VER }}

- name: install transport-memcached plugin
  command: >
    creates=/usr/share/elasticsearch/plugins/transport-memcached
    /usr/share/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-transport-memcached/{{ ES_TRANSPORT_MEMCACHED_VER }}

- name: remove default config
  file: >
    path={{ item }}
    state=absent
  with_items:
    - /etc/default/elasticsearch
    - /etc/elasticsearch/elasticsearch.yml

- name: create custom config
  template: >
    dest=/etc/elasticsearch/{{ item }}
    src={{ item }}
  with_items:
    - config-0.yml
    - config-1.yml
    - logging.yml
  notify: restart elasticsearch

- name: create elasticsearch service script
  template: >
    dest=/etc/init.d/elasticsearch
    src=elasticsearch.service
  notify: restart elasticsearch

- name: start elasticsearch
  service: >
    enabled=yes
    name=elasticsearch
    state=started