forked from ISTI-ansible-roles/ansible-roles
Check if a jdk is installed and set jdk_java_home accordingly. See https://support.d4science.org/issues/16607
This commit is contained in:
parent
ba11859d87
commit
9354f4e483
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
- import_tasks: set_jdk_home.yml
|
||||||
- import_tasks: smartgears-app.yml
|
- import_tasks: smartgears-app.yml
|
||||||
- import_tasks: data-transfer-service.yml
|
- import_tasks: data-transfer-service.yml
|
||||||
when: data_transfer_service_install
|
when: data_transfer_service_install
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Are we using the distribution OpenJDK?
|
||||||
|
stat:
|
||||||
|
path: /usr/lib/jvm/java-{{ openjdk_default }}-openjdk-amd64
|
||||||
|
register: jdk_java_home_path
|
||||||
|
when: openjdk_default is defined
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: 'The jdk java home is {{ jdk_java_home_path.stat.path }}'
|
||||||
|
when: jdk_java_home_path.stat.path is defined
|
||||||
|
|
||||||
|
- name: Set the Java home when we are using the distribution OpenJDK
|
||||||
|
set_fact:
|
||||||
|
jdk_java_home: '{{ jdk_java_home_path.stat.path }}'
|
||||||
|
when: jdk_java_home_path.stat.isdir is defined and jdk_java_home_path.stat.isdir
|
||||||
|
|
||||||
|
when: jdk_java_home is not defined
|
||||||
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Are we using the Zulu OpenJDK?
|
||||||
|
stat:
|
||||||
|
path: /usr/lib/jvm/zulu-{{ openjdk_default }}-amd64
|
||||||
|
register: jdk_java_home_path
|
||||||
|
when: openjdk_default is defined
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: 'The jdk java home is {{ jdk_java_home_path.stat.path }}'
|
||||||
|
when: jdk_java_home_path.stat.path is defined
|
||||||
|
|
||||||
|
- name: Set the Java home when we are using the distribution OpenJDK
|
||||||
|
set_fact:
|
||||||
|
jdk_java_home: '{{ jdk_java_home_path.stat.path }}'
|
||||||
|
when: jdk_java_home_path.stat.isdir is defined and jdk_java_home_path.stat.isdir
|
||||||
|
|
||||||
|
when: jdk_java_home is not defined
|
||||||
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Are we using the Oracle JDK?
|
||||||
|
stat:
|
||||||
|
path: /usr/lib/jvm/java-{{ jdk_default }}-oracle
|
||||||
|
register: jdk_java_home_path
|
||||||
|
when: openjdk_default is not defined
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: 'The jdk java home is {{ jdk_java_home_path.stat.path }}'
|
||||||
|
when: jdk_java_home_path.stat.path is defined
|
||||||
|
|
||||||
|
- name: Set the Java home when we are using the Oracle JDK
|
||||||
|
set_fact:
|
||||||
|
jdk_java_home: '{{ jdk_java_home_path.stat.path }}'
|
||||||
|
when: jdk_java_home_path.stat.isdir is defined and jdk_java_home_path.stat.isdir
|
||||||
|
|
||||||
|
when: jdk_java_home is not defined
|
||||||
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
|
- name: Fail if we are not able to set the jdk_java_home variable
|
||||||
|
fail:
|
||||||
|
msg: 'No valid JDK installation found, failing!'
|
||||||
|
when: jdk_java_home is not defined
|
||||||
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
Loading…
Reference in New Issue