Commit 77aa67d7 by Fred Smith

Merge pull request #2588 from edx/derf/elasticsearch_2_1

Elasticsearch 1.5
parents ca7e0680 c561ef53
...@@ -3,14 +3,15 @@ elasticsearch_app_dir: "{{ COMMON_APP_DIR }}/elasticsearch" ...@@ -3,14 +3,15 @@ elasticsearch_app_dir: "{{ COMMON_APP_DIR }}/elasticsearch"
elasticsearch_data_dir: "{{ COMMON_DATA_DIR }}/elasticsearch" elasticsearch_data_dir: "{{ COMMON_DATA_DIR }}/elasticsearch"
elasticsearch_log_dir: "{{ COMMON_LOG_DIR }}/elasticsearch" elasticsearch_log_dir: "{{ COMMON_LOG_DIR }}/elasticsearch"
elasticsearch_cfg_dir: "{{ COMMON_CFG_DIR }}/elasticsearch" elasticsearch_cfg_dir: "{{ COMMON_CFG_DIR }}/elasticsearch"
elasticsearch_version: "0.90.11" elasticsearch_apt_key: "46095ACC8548582C1A2699A9D27D666CD88E42B4"
elasticsearch_sha: "8e81388d0ba7e427b42514d96e25ba6499024c24" elasticsearch_apt_keyserver: "ha.pool.sks-keyservers.net"
elasticsearch_file: "elasticsearch-{{ elasticsearch_version }}.deb" elasticsearch_repo: "deb http://packages.elasticsearch.org/elasticsearch/1.5/debian stable main"
elasticsearch_url: "https://download.elasticsearch.org/elasticsearch/elasticsearch/{{ elasticsearch_file }}" elasticsearch_package_name: "elasticsearch"
elasticsearch_user: "elasticsearch" elasticsearch_user: "elasticsearch"
elasticsearch_group: "elasticsearch" elasticsearch_group: "elasticsearch"
# #
# Defaults for a single server installation. # Defaults for a single server installation.
ELASTICSEARCH_CLUSTERED: false ELASTICSEARCH_CLUSTER_MEMBERS: []
ELASTICSEARCH_HEAP_SIZE: "512m" ELASTICSEARCH_HEAP_SIZE: "512m"
ELASTICSEARCH_VERSION: "1.5.2"
...@@ -29,47 +29,91 @@ ...@@ -29,47 +29,91 @@
# - elasticsearch # - elasticsearch
# #
- name: download elasticsearch - name: Install Elasticsearch repo key
get_url: > apt_key:
url={{ elasticsearch_url }} id: "{{ elasticsearch_apt_key }}"
dest=/var/tmp/{{ elasticsearch_file }} keyserver: "{{ elasticsearch_apt_keyserver }}"
force=no state: present
register: elasticsearch_reinstall tags:
- install
- install:base
- name: install elasticsearch from local package - name: Add Elasticsearch Repo
shell: > apt_repository:
dpkg -i --force-confold /var/tmp/elasticsearch-{{ elasticsearch_version }}.deb repo: "{{ elasticsearch_repo }}"
executable=/bin/bash state: present
when: elasticsearch_reinstall.changed tags:
- install
- install:base
- name: install elasticsearch
apt:
pkg: "{{ elasticsearch_package_name }}={{ ELASTICSEARCH_VERSION }}"
state: present
install_recommends: yes
force: yes
update_cache: yes
tags:
- install
- install:base
register: elasticsearch_reinstall
- name: create directories - name: create directories
file: > file:
path="{{ item }}" path: "{{ item }}"
state=directory state: directory
owner="{{ elasticsearch_user }}" owner: "{{ elasticsearch_user }}"
group="{{ elasticsearch_group }}" group: "{{ elasticsearch_group }}"
with_items: with_items:
- "{{ elasticsearch_data_dir }}" - "{{ elasticsearch_data_dir }}"
- "{{ elasticsearch_log_dir }}" - "{{ elasticsearch_log_dir }}"
- "{{ elasticsearch_cfg_dir }}" - "{{ elasticsearch_cfg_dir }}"
tags:
- install
- install:base
- name: update elasticsearch defaults - name: update elasticsearch defaults
template: > template:
src=etc/default/elasticsearch.j2 dest=/etc/default/elasticsearch src: etc/default/elasticsearch.j2
dest: /etc/default/elasticsearch
tags:
- install
- install:configuration
- name: drop the elasticsearch config - name: drop the elasticsearch config
template: > template:
src=edx/etc/elasticsearch/elasticsearch.yml.j2 dest={{ elasticsearch_cfg_dir }}/elasticsearch.yml src: edx/etc/elasticsearch/elasticsearch.yml.j2
mode=0744 dest: "{{ elasticsearch_cfg_dir }}/elasticsearch.yml"
mode: 0744
tags:
- install
- install:configuration
- name: drop the elasticsearch logging config - name: drop the elasticsearch logging config
template: > template:
src=edx/etc/elasticsearch/logging.yml.j2 dest={{ elasticsearch_cfg_dir }}/logging.yml src: edx/etc/elasticsearch/logging.yml.j2
mode=0744 dest: "{{ elasticsearch_cfg_dir }}/logging.yml"
mode: 0744
tags:
- install
- install:configuration
- name: Ensure elasticsearch is enabled and started - name: Ensure elasticsearch is enabled and started
service: name=elasticsearch state=started enabled=yes service:
name: elasticsearch
state: started
enabled: yes
tags:
- manage
- manage:start
- name: Restart elastic when there has been an upgrade - name: Restart elastic when there has been an upgrade
service: name=elasticsearch state=restarted enabled=yes service:
name: elasticsearch
state: restarted
enabled: yes
when: elasticsearch_reinstall.changed when: elasticsearch_reinstall.changed
tags:
- manage
- manage:restart
- install
...@@ -33,14 +33,9 @@ script.disable_dynamic: true ...@@ -33,14 +33,9 @@ script.disable_dynamic: true
# to perform discovery when new nodes (master or data) are started: # to perform discovery when new nodes (master or data) are started:
# #
# discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"] # discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
{%- if ELASTICSEARCH_CLUSTERED -%} {%- if ELASTICSEARCH_CLUSTER_MEMBERS|length > 1 -%}
{%- set hosts= [] -%}
{%- for host in hostvars.keys() -%} discovery.zen.ping.unicast.hosts: ['{{ELASTICSEARCH_CLUSTER_MEMBERS|join("\',\'") }}']
{% do hosts.append(host) %}
{%- endfor %}
discovery.zen.ping.unicast.hosts: ['{{hosts|join("\',\'") }}']
{% endif -%} {% endif -%}
......
...@@ -34,8 +34,5 @@ DATA_DIR={{ COMMON_DATA_DIR }} ...@@ -34,8 +34,5 @@ DATA_DIR={{ COMMON_DATA_DIR }}
# ElasticSearch configuration directory # ElasticSearch configuration directory
CONF_DIR={{ elasticsearch_cfg_dir }} CONF_DIR={{ elasticsearch_cfg_dir }}
# ElasticSearch configuration file (elasticsearch.yml)
CONF_FILE=${CONF_DIR}/elasticsearch.yml
# Additional Java OPTS # Additional Java OPTS
#ES_JAVA_OPTS= #ES_JAVA_OPTS=
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment