fixed Elasticsearch installation's issues caused by the absense of Java in Ubuntu Trusty
This commit is contained in:
parent
df428f5f52
commit
eb70809add
@ -25,17 +25,17 @@ platforms:
|
|||||||
# command: /sbin/init
|
# command: /sbin/init
|
||||||
# ulimits:
|
# ulimits:
|
||||||
# - nofile:262144:262144
|
# - nofile:262144:262144
|
||||||
#- name: trusty
|
- name: trusty
|
||||||
#image: ubuntu:trusty
|
image: ubuntu:trusty
|
||||||
#memory_reservation: 1024m
|
|
||||||
#ulimits:
|
|
||||||
#- nofile:262144:262144
|
|
||||||
- name: centos6
|
|
||||||
image: centos:6
|
|
||||||
privileged: true
|
|
||||||
memory_reservation: 1024m
|
memory_reservation: 1024m
|
||||||
ulimits:
|
ulimits:
|
||||||
- nofile:262144:262144
|
- nofile:262144:262144
|
||||||
|
# - name: centos6
|
||||||
|
# image: centos:6
|
||||||
|
# privileged: true
|
||||||
|
# memory_reservation: 1024m
|
||||||
|
# ulimits:
|
||||||
|
# - nofile:262144:262144
|
||||||
# - name: centos7
|
# - name: centos7
|
||||||
# image: milcom/centos7-systemd
|
# image: milcom/centos7-systemd
|
||||||
# memory_reservation: 1024m
|
# memory_reservation: 1024m
|
||||||
|
|||||||
@ -14,6 +14,42 @@
|
|||||||
- ansible_distribution == "Ubuntu"
|
- ansible_distribution == "Ubuntu"
|
||||||
- ansible_distribution_major_version | int == 14
|
- ansible_distribution_major_version | int == 14
|
||||||
|
|
||||||
|
- name: Update and upgrade apt packages
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
upgrade: yes
|
||||||
|
update_cache: yes
|
||||||
|
cache_valid_time: 86400 #One day
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Ubuntu"
|
||||||
|
- ansible_distribution_major_version | int == 14
|
||||||
|
|
||||||
|
- name: Install Oracle Java 8
|
||||||
|
become: yes
|
||||||
|
apt: name=openjdk-8-jdk state=latest
|
||||||
|
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Ubuntu"
|
||||||
|
- ansible_distribution_major_version | int == 14
|
||||||
|
|
||||||
|
- name: Set the default Java version
|
||||||
|
become: yes
|
||||||
|
shell: update-alternatives --config java
|
||||||
|
|
||||||
|
- name: Set the default Javac version
|
||||||
|
become: yes
|
||||||
|
shell: update-alternatives --config javac
|
||||||
|
|
||||||
|
- name: Update and upgrade apt packages
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
upgrade: yes
|
||||||
|
update_cache: yes
|
||||||
|
cache_valid_time: 86400 #One day
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Ubuntu"
|
||||||
|
- ansible_distribution_major_version | int == 14
|
||||||
|
|
||||||
- name: Debian/Ubuntu | Add Elasticsearch GPG key.
|
- name: Debian/Ubuntu | Add Elasticsearch GPG key.
|
||||||
apt_key:
|
apt_key:
|
||||||
url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch"
|
url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch"
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
yum:
|
yum:
|
||||||
name: java-1.8.0-openjdk.x86_64
|
name: java-1.8.0-openjdk.x86_64
|
||||||
state: present
|
state: present
|
||||||
|
when:
|
||||||
|
- ansible_distribution in ['CentOS', 'RedHat'] and ansible_distribution_major_version|int < 7
|
||||||
|
|
||||||
- name: RedHat/CentOS/Fedora | Install Elasticsarch
|
- name: RedHat/CentOS/Fedora | Install Elasticsarch
|
||||||
package: name=elasticsearch-{{ elastic_stack_version }} state=present
|
package: name=elasticsearch-{{ elastic_stack_version }} state=present
|
||||||
|
|||||||
@ -206,26 +206,9 @@
|
|||||||
- not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<'))
|
- not (ansible_distribution == "Debian" and ansible_distribution_version is version('8', '<'))
|
||||||
- not (ansible_os_family == "RedHat" and ansible_distribution_version is version('7', '<'))
|
- 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
|
|
||||||
# ignore_errors: true
|
|
||||||
|
|
||||||
# - 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
|
- name: Distribution is centos 6.* | Enable Elasticsearch
|
||||||
service: name=elasticsearch enabled=yes
|
service: name=elasticsearch enabled=yes
|
||||||
|
|
||||||
|
|
||||||
#- name: Distribution is centos 6.* | Reload Elasticsearch
|
|
||||||
# service: name=elasticsearch state=reloaded
|
|
||||||
# state: "{{ elasticsearch_state | default('reloaded') }}"
|
|
||||||
|
|
||||||
- name: Distribution is centos 6.* | Start Elasticsearch
|
- name: Distribution is centos 6.* | Start Elasticsearch
|
||||||
service: name=elasticsearch state=started
|
service: name=elasticsearch state=started
|
||||||
|
|
||||||
@ -234,12 +217,6 @@
|
|||||||
name: elasticsearch
|
name: elasticsearch
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
# ignore_errors: true
|
|
||||||
# when:
|
|
||||||
# - not (ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA")
|
|
||||||
# - 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: Make sure Elasticsearch is running before proceeding
|
- name: Make sure Elasticsearch is running before proceeding
|
||||||
wait_for: host={{ elasticsearch_network_host }} port={{ elasticsearch_http_port }} delay=3 timeout=300
|
wait_for: host={{ elasticsearch_network_host }} port={{ elasticsearch_http_port }} delay=3 timeout=300
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user