fixed elasticsearch installation for Centos 6.* - Adding Java Installation

This commit is contained in:
Rshad Zhran 2019-07-15 14:04:13 +02:00
parent d08b013224
commit df428f5f52
4 changed files with 21 additions and 12 deletions

View File

@ -41,7 +41,7 @@ platforms:
# memory_reservation: 1024m
# privileged: true
# ulimits:
- nofile:262144:262144
# - nofile:262144:262144
provisioner:
name: ansible
playbooks:

View File

@ -10,7 +10,7 @@ def test_elasticsearch_is_installed(host):
"""Test if the elasticsearch package is installed."""
elasticsearch = host.package("elasticsearch")
assert elasticsearch.is_installed
assert elasticsearch.version.startswith('6.7.1')
assert elasticsearch.version.startswith('7.1.1')
def test_elasticsearch_is_running(host):

View File

@ -9,6 +9,11 @@
gpgcheck: true
changed_when: false
- name: CentOS x.x => x.x < 7.0 | Installing Java
yum:
name: java-1.8.0-openjdk.x86_64
state: present
- name: RedHat/CentOS/Fedora | Install Elasticsarch
package: name=elasticsearch-{{ elastic_stack_version }} state=present
tags: install

View File

@ -205,22 +205,26 @@
- not (ansible_distribution == "Ubuntu" and ansible_distribution_version is version('15.04', '<'))
- not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<'))
- not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<'))
- name: Get Java version
shell: java -version |& awk -F'"' '{print $2}'
register: java_version
- debug: msg="{{ java_version.stdout_lines }}"
#- name: Get Java version
# shell: java -version |& awk -F'"' '{print $2}'
# register: java_version
# ignore_errors: true
- name: "Install Java Repo for Trusty"
yum_repository: repo='ppa:openjdk-r/ppa'
when:
- ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7
# - debug: msg="{{ java_version.stdout_lines }}"
#- name: "Install Java Repo for Trusty"
# yum_repository: repo='ppa:openjdk-r/ppa'
# when:
# - ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7
- name: Distribution is centos 6.* | Enable Elasticsearch
service: name=elasticsearch enabled=yes
- name: Distribution is centos 6.* | Reload Elasticsearch
service: name=elasticsearch state=reloaded
#- name: Distribution is centos 6.* | Reload Elasticsearch
# service: name=elasticsearch state=reloaded
# state: "{{ elasticsearch_state | default('reloaded') }}"
- name: Distribution is centos 6.* | Start Elasticsearch
service: name=elasticsearch state=started