From 43996fffcdd83115e70cbd09d9bf9360dd47a2b4 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Fri, 21 Aug 2020 13:03:35 +1000 Subject: [PATCH] DCD-1020: Make/enforce assumption that JVM packages setup a common symlink. --- group_vars/aws_node_local.yml | 6 ++++-- roles/crowd_config/tasks/main.yml | 4 ++-- roles/product_common/tasks/ubuntu.yml | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/group_vars/aws_node_local.yml b/group_vars/aws_node_local.yml index 9ce6b3f..f951617 100644 --- a/group_vars/aws_node_local.yml +++ b/group_vars/aws_node_local.yml @@ -34,8 +34,10 @@ atl_product_installation_versioned: "{{ atl_product_installation_base }}/{{ atl_ atl_product_installation_current: "{{ atl_product_installation_base }}/current" atl_installer_temp: "{{ atl_installation_base }}/tmp" -atl_jre_home: "{{ 'java' if atl_use_system_jdk else (atl_product_installation_current + '/jre') }}" -atl_java_binary: "{{ atl_jre_home }}/bin/java" +# NOTE: If using the non-installer java we expect to have the full JDK +# installed and linked to `/usr/lib/jvm/java`, usually via `alternatives`. +atl_java_home: "{{ '/usr/lib/jvm/java' if atl_use_system_jdk else (atl_product_installation_current + '/jre') }}" +atl_java_binary: "{{ atl_java_home }}/bin/java" atl_product_logs_default: &logs_default - path: "{{ atl_product_installation_current }}/logs/*" diff --git a/roles/crowd_config/tasks/main.yml b/roles/crowd_config/tasks/main.yml index 726211a..e3b7c72 100644 --- a/roles/crowd_config/tasks/main.yml +++ b/roles/crowd_config/tasks/main.yml @@ -51,7 +51,7 @@ lineinfile: path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh" insertafter: "EOF" - line: 'export JAVA_HOME=/usr/lib/jvm/jre-{{ java_version }}-openjdk' + line: "export JAVA_HOME={{ atl_java_home }}" - name: Create application directories file: @@ -152,4 +152,4 @@ - name: Remove crowd.xml to prevent duplicates from appearing in cluster reporting file: path: "{{ atl_product_installation_versioned }}/apache-tomcat/conf/Catalina/localhost/crowd.xml" - state: absent \ No newline at end of file + state: absent diff --git a/roles/product_common/tasks/ubuntu.yml b/roles/product_common/tasks/ubuntu.yml index 55c6311..2b0eef8 100644 --- a/roles/product_common/tasks/ubuntu.yml +++ b/roles/product_common/tasks/ubuntu.yml @@ -1,9 +1,20 @@ --- - name: Install JDK if necessary on Ubuntu - package: - name: - - openjdk-{{ java_major_version }}-jdk-headless + block: + + - name: Install JDK package + package: + name: + - openjdk-{{ java_major_version }}-jdk-headless + + - name: Ensure common symlink exists + alternatives: + link: "/usr/lib/jvm/java" + name: "java_sdk" + path: "/usr/lib/jvm/java-8-openjdk-amd64" + priority: 99 + when: atl_use_system_jdk tags: - runtime_pkg