From ee86f524ad7ec7b031fbee0e2f84d26cc07d4783 Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Wed, 15 Nov 2023 13:32:44 +0000 Subject: [PATCH] Change default JDK for alpine arm64 --- .../roles/Common/tasks/Alpine.yml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Alpine.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Alpine.yml index b05ce1fc7a..5bcfd453af 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Alpine.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Alpine.yml @@ -14,6 +14,11 @@ register: usr_lib_jvm_exists tags: build_tools +- name: Checking for default-jvm + stat: path=/usr/lib/jvm/default-jvm + register: usr_lib_default_jvm_exists + tags: build_tools + - name: Creating /usr/lib/jvm if not found file: path: /usr/lib/jvm @@ -140,14 +145,14 @@ - name: Install java 11 from Alpine repositories package: "name=openjdk11 state=installed" - when: not adoptopenjdk11_installed.stat.exists + when: ansible_architecture != "aarch64" and not adoptopenjdk11_installed.stat.exists - name: Create symlink to point at openjdk11 file: src: /usr/lib/jvm/java-11-openjdk dest: /usr/lib/jvm/jdk-11 state: link - when: not adoptopenjdk11_installed.stat.exists + when: ansible_architecture != "aarch64" and not adoptopenjdk11_installed.stat.exists - name: Check if zulu-16 is already installed in the target location stat: path=/usr/lib/jvm/zulu16 @@ -201,6 +206,19 @@ when: - not adoptopenjdk17_installed.stat.exists + - name: Remove Default JVM For Alpine AARCH64 + file: + path: /usr/lib/jvm/default-jvm + state: absent + when: ansible_architecture == "aarch64" and usr_lib_default_jvm_exists.stat.exists + + - name: Arm64 Change Default JVM Link to JDK17 + file: + src: '{{ adoptopenjdk17_dir.stdout }}' + dest: /usr/lib/jvm/default-jvm + state: link + when: ansible_architecture == "aarch64" + - name: Check if zulu-18 is already installed in the target location stat: path=/usr/lib/jvm/zulu18 register: zulu18_installed