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"
elasticsearch_data_dir: "{{ COMMON_DATA_DIR }}/elasticsearch"
elasticsearch_log_dir: "{{ COMMON_LOG_DIR }}/elasticsearch"
elasticsearch_cfg_dir: "{{ COMMON_CFG_DIR }}/elasticsearch"
elasticsearch_version: "0.90.11"
elasticsearch_sha: "8e81388d0ba7e427b42514d96e25ba6499024c24"
elasticsearch_file: "elasticsearch-{{ elasticsearch_version }}.deb"
elasticsearch_url: "https://download.elasticsearch.org/elasticsearch/elasticsearch/{{ elasticsearch_file }}"
elasticsearch_apt_key: "46095ACC8548582C1A2699A9D27D666CD88E42B4"
elasticsearch_apt_keyserver: "ha.pool.sks-keyservers.net"
elasticsearch_repo: "deb http://packages.elasticsearch.org/elasticsearch/1.5/debian stable main"
elasticsearch_package_name: "elasticsearch"
elasticsearch_user: "elasticsearch"
elasticsearch_group: "elasticsearch"
#
# Defaults for a single server installation.
ELASTICSEARCH_CLUSTERED: false
ELASTICSEARCH_CLUSTER_MEMBERS: []
ELASTICSEARCH_HEAP_SIZE: "512m"
ELASTICSEARCH_VERSION: "1.5.2"
......@@ -29,47 +29,91 @@
# - elasticsearch
#
- name: download elasticsearch
get_url: >
url={{ elasticsearch_url }}
dest=/var/tmp/{{ elasticsearch_file }}
force=no
register: elasticsearch_reinstall
- name: Install Elasticsearch repo key
apt_key:
id: "{{ elasticsearch_apt_key }}"
keyserver: "{{ elasticsearch_apt_keyserver }}"
state: present
tags:
- install
- install:base
- name: install elasticsearch from local package
shell: >
dpkg -i --force-confold /var/tmp/elasticsearch-{{ elasticsearch_version }}.deb
executable=/bin/bash
when: elasticsearch_reinstall.changed
- name: Add Elasticsearch Repo
apt_repository:
repo: "{{ elasticsearch_repo }}"
state: present
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
file: >
path="{{ item }}"
state=directory
owner="{{ elasticsearch_user }}"
group="{{ elasticsearch_group }}"
file:
path: "{{ item }}"
state: directory
owner: "{{ elasticsearch_user }}"
group: "{{ elasticsearch_group }}"
with_items:
- "{{ elasticsearch_data_dir }}"
- "{{ elasticsearch_log_dir }}"
- "{{ elasticsearch_cfg_dir }}"
tags:
- install
- install:base
- name: update elasticsearch defaults
template: >
src=etc/default/elasticsearch.j2 dest=/etc/default/elasticsearch
template:
src: etc/default/elasticsearch.j2
dest: /etc/default/elasticsearch
tags:
- install
- install:configuration
- name: drop the elasticsearch config
template: >
src=edx/etc/elasticsearch/elasticsearch.yml.j2 dest={{ elasticsearch_cfg_dir }}/elasticsearch.yml
mode=0744
template:
src: edx/etc/elasticsearch/elasticsearch.yml.j2
dest: "{{ elasticsearch_cfg_dir }}/elasticsearch.yml"
mode: 0744
tags:
- install
- install:configuration
- name: drop the elasticsearch logging config
template: >
src=edx/etc/elasticsearch/logging.yml.j2 dest={{ elasticsearch_cfg_dir }}/logging.yml
mode=0744
template:
src: edx/etc/elasticsearch/logging.yml.j2
dest: "{{ elasticsearch_cfg_dir }}/logging.yml"
mode: 0744
tags:
- install
- install:configuration
- 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
service: name=elasticsearch state=restarted enabled=yes
service:
name: elasticsearch
state: restarted
enabled: yes
when: elasticsearch_reinstall.changed
tags:
- manage
- manage:restart
- install
......@@ -33,14 +33,9 @@ script.disable_dynamic: true
# to perform discovery when new nodes (master or data) are started:
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
{%- if ELASTICSEARCH_CLUSTERED -%}
{%- set hosts= [] -%}
{%- if ELASTICSEARCH_CLUSTER_MEMBERS|length > 1 -%}
{%- for host in hostvars.keys() -%}
{% do hosts.append(host) %}
{%- endfor %}
discovery.zen.ping.unicast.hosts: ['{{hosts|join("\',\'") }}']
discovery.zen.ping.unicast.hosts: ['{{ELASTICSEARCH_CLUSTER_MEMBERS|join("\',\'") }}']
{% endif -%}
......
......@@ -34,8 +34,5 @@ DATA_DIR={{ COMMON_DATA_DIR }}
# ElasticSearch configuration directory
CONF_DIR={{ elasticsearch_cfg_dir }}
# ElasticSearch configuration file (elasticsearch.yml)
CONF_FILE=${CONF_DIR}/elasticsearch.yml
# Additional 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