Skip to content

Instantly share code, notes, and snippets.

@gjedeer
Created February 16, 2024 07:53
Show Gist options
  • Save gjedeer/85dfcc3a40201a4af8bc52e7087f66e9 to your computer and use it in GitHub Desktop.
Save gjedeer/85dfcc3a40201a4af8bc52e7087f66e9 to your computer and use it in GitHub Desktop.
Bellsoft-Java on Debian with proper GPG key management - Ansible role
- name: Download BellSoft official GPG key
ansible.builtin.get_url:
url: https://download.bell-sw.com/pki/GPG-KEY-bellsoft
dest: /etc/apt/keyrings/bellsoft.asc
mode: '0644'
when: ansible_os_family == "Debian"
- name: Add Bellsoft repo (Debian)
ansible.builtin.apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/bellsoft.asc] https://apt.bell-sw.com/ stable main"
state: present
filename: bellsoft
update_cache: true
when: ansible_os_family == "Debian"
- name: Update repositories and install BellSoft Java 21
ansible.builtin.apt:
update_cache: yes
name: bellsoft-java21
state: present
when: ansible_os_family == "Debian"
- name: Update alternatives for java
community.general.alternatives:
name: java
path: /usr/lib/jvm/bellsoft-java21-amd64/bin/java
when: ansible_os_family == "Debian"
- name: Update alternatives for javac
community.general.alternatives:
name: javac
path: /usr/lib/jvm/bellsoft-java21-amd64/bin/javac
when: ansible_os_family == "Debian"
- name: Update alternatives for jar
community.general.alternatives:
name: jar
path: /usr/lib/jvm/bellsoft-java21-amd64/bin/jar
when: ansible_os_family == "Debian"
- name: Update alternatives for keytool
community.general.alternatives:
name: keytool
path: /usr/lib/jvm/bellsoft-java21-amd64/bin/keytool
when: ansible_os_family == "Debian"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment