Skip to content

Commit

Permalink
ansible: install temurin JDK on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Nov 20, 2022
1 parent b8bba8b commit 337d2fc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
21 changes: 1 addition & 20 deletions ansible/roles/java-base/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,13 @@
# Package manager mapping in ansible/roles/package-upgrade/vars/main.yml.
use: "{{ os|match_key(pm)|default(omit) }}"

- name: install java tap (macOS)
become_user: administrator
when: java.rc > 0 and os|startswith("macos") and arch == "x64"
homebrew_tap:
name: AdoptOpenJDK/openjdk
state: present

- name: install java (macOS)
become_user: administrator
when: java.rc > 0 and os|startswith("macos") and arch == "x64"
when: java.rc > 0 and os|startswith("macos")
homebrew_cask:
name: "{{ java_package_name }}"
state: present

- name: Fetch java (Apple Silicon)
when: java.rc > 0 and os|startswith("macos11") and arch == "arm64"
shell:
chdir: "/Users/{{ ansible_user }}"
cmd: "curl -L -o zulu8.52.0.23-ca-jdk8.0.282-macosx_aarch64.tar.gz https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-macosx_aarch64.tar.gz"

- name: Extract java (Apple Silicon)
when: java.rc > 0 and os|startswith("macos11") and arch == "arm64"
shell:
chdir: "/Users/{{ ansible_user }}"
cmd: "tar -xf zulu8.52.0.23-ca-jdk8.0.282-macosx_aarch64.tar.gz"

- name: install webupd8 oracle java 8 extras
when: java.rc > 0 and os == "ubuntu1404" and arch != "ppc64"
package: name="{{item}}" state=present
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/java-base/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ packages: {
'fedora': 'java-1.8.0-openjdk-headless',
'freebsd': 'openjdk8-jre',
'ibmi': 'openjdk-11-ea',
'macos': 'adoptopenjdk8',
'macos': 'temurin',
'rhel7': 'java-11-openjdk',
'rhel8': 'java-17-openjdk',
'smartos': 'openjdk8',
Expand Down
3 changes: 1 addition & 2 deletions ansible/roles/jenkins-worker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ java_path: {
'macos10.14': 'java',
'macos10.15': 'java',
'macos11': 'java',
# Currently hardcoded untill adopt have their build available
'macos11.0': '/Users/{{ ansible_user }}/zulu8.52.0.23-ca-jdk8.0.282-macosx_aarch64/bin/java',
'macos11.0': 'java',
'smartos15': '/opt/local/java/openjdk8/bin/java',
'smartos16': '/opt/local/java/openjdk8/bin/java',
'smartos17': '/opt/local/java/openjdk8/bin/java',
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/package-upgrade/tasks/partials/brew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
script: files/install-xcode.sh
when: xcode.rc > 1

- name: Check if Homebrew is already installed (Apple Sillicon)
- name: Check if Homebrew is already installed (Apple Silicon)
stat:
path: /opt/homebrew/bin/brew
register: armbrew
Expand Down

0 comments on commit 337d2fc

Please sign in to comment.