Ensure the default version of Java is set
When installing ES and Logstash the system version of java needs to match the expected version of java ES and Logstash will use. This change, uses the `update-alternatives` command to set the java version to the expected value when more than one java exists on a system. The nessisity for this change came from OS level upgrades within environments running OLD versions of ES. Upon upgrading the base OS our playbooks could not complete an upgrade of ES which was due to the java expectations. Once the alternantives were set accordingly the upgrade completed without issues. Change-Id: I9025967f723ee17940e11789f503e342cdad6f2a Signed-off-by: cloudnull <kevin@cloudnull.com>
This commit is contained in:
parent
4d904e2b7c
commit
a3afb64654
@ -41,3 +41,6 @@ elastic_lxc_template_config:
|
||||
# be derived automatically using 1/4 of the available RAM for logstash and 1/2
|
||||
# of the available RAM for elasticsearch. The value is expected to be in MiB.
|
||||
# elastic_heap_size_default: 10240 # type `int`
|
||||
|
||||
# Set the friendly name of the version of java that will be used as the default.
|
||||
elastic_java_version: java-8
|
||||
|
@ -195,6 +195,21 @@
|
||||
tags:
|
||||
- package_install
|
||||
|
||||
- name: Set java alternatives
|
||||
block:
|
||||
- name: Get java version alternantive
|
||||
shell: >-
|
||||
update-alternatives --query java | awk -F':' '/{{ elastic_java_version }}/ && /Alternative/ {print $2}'
|
||||
register: java_alternatives
|
||||
changed_when: false
|
||||
|
||||
- name: Set java version alternantive
|
||||
alternatives:
|
||||
name: java
|
||||
path: "{{ java_alternatives.stdout.strip() }}"
|
||||
when:
|
||||
- (ansible_os_family | lower) == 'debian'
|
||||
|
||||
- name: Ensure service directories exists
|
||||
file:
|
||||
path: "/etc/{{ service_name }}"
|
||||
|
Loading…
Reference in New Issue
Block a user