Elasticsearch install on Debian complete
This commit is contained in:
parent
f504a1a5e9
commit
4b8550f6ef
7 changed files with 51 additions and 1 deletions
|
|
@ -1 +1,2 @@
|
|||
---
|
||||
elasticsearch_version: "1.5.2"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ galaxy_info:
|
|||
description: Elasticsearch for Linux
|
||||
company: "Elastic.co"
|
||||
license: "license (Apache)"
|
||||
min_ansible_version: 1.4
|
||||
# Require 1.6 for apt deb install
|
||||
min_ansible_version: 1.6
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
|
|
|
|||
40
tasks/elasticsearch.yml
Normal file
40
tasks/elasticsearch.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
# Packages
|
||||
- name: Define elasticsearch_package (Debian)
|
||||
set_fact:
|
||||
elasticsearch_package: "elasticsearch-{{ elasticsearch_version}}.deb"
|
||||
when: elasticsearch_package is not defined and ansible_os_family == 'Debian'
|
||||
- name: Define elasticsearch_package (Redhat)
|
||||
set_fact:
|
||||
elasticsearch_package: "elasticsearch-{{ elasticsearch_version}}.noarch.rpm"
|
||||
when: elasticsearch_package is not defined and ansible_os_family == 'RedHat'
|
||||
- name: Define elasticsearch_package (Linux)
|
||||
set_fact:
|
||||
elasticsearch_package: "elasticsearch-{{ elasticsearch_version}}.tar.gz"
|
||||
when: elasticsearch_package is not defined
|
||||
|
||||
- name: Define elasticsearch_url
|
||||
set_fact:
|
||||
elasticsearch_url: "https://download.elastic.co/elasticsearch/elasticsearch/{{ elasticsearch_package}}"
|
||||
when: elasticsearch_url is not defined
|
||||
|
||||
- debug: var=elasticsearch_url
|
||||
|
||||
# TODO Is /opt always a good destination?
|
||||
# It is good to always have one location to avoid downloading again
|
||||
# It is bad to have a location hard-coded because we don't know if it
|
||||
# will always exist and have space... better to use mktemp, but then
|
||||
# have to ensure that desired version is already installde with
|
||||
# dpkg-query -W elasticsearch and parse the output...
|
||||
- name: Download elasticsearch package
|
||||
get_url: url={{ elasticsearch_url }} dest=/opt/{{ elasticsearch_package}}
|
||||
|
||||
# Debian section
|
||||
- name: Ensure elasticsearch is installed.
|
||||
apt: deb=/opt/{{ elasticsearch_package }} state=installed
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
# Linux section
|
||||
- name: Ensure elasticsearch is installed.
|
||||
apt: deb=/opt/{{ elasticsearch_package }} state=installed
|
||||
when: ansible_os_family == 'Linux'
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
#- name: Include default varsiables.
|
||||
# include_vars: "main.yml"
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
- include: java.yml
|
||||
- include: elasticsearch.yml
|
||||
|
|
|
|||
1
vars/Linux.yml
Normal file
1
vars/Linux.yml
Normal file
|
|
@ -0,0 +1 @@
|
|||
---
|
||||
1
vars/RedHat.yml
Normal file
1
vars/RedHat.yml
Normal file
|
|
@ -0,0 +1 @@
|
|||
---
|
||||
3
vars/main.yml
Normal file
3
vars/main.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
__elasticsearch_version: "1.5.2"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue