2021-06-17 02:49:01 +00:00
|
|
|
- name: Install GPG
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.apt:
|
2021-06-17 02:49:01 +00:00
|
|
|
name: gpg
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add AdoptOpenJDK's signing key
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.apt_key:
|
2021-06-17 02:49:01 +00:00
|
|
|
id: 8ED17AF5D7E675EB3EE3BCE98AC3B29174885C03
|
|
|
|
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
|
|
|
|
|
|
|
|
- name: Install AdoptOpenJDK repository
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.apt_repository:
|
2021-06-17 02:49:01 +00:00
|
|
|
repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main
|
|
|
|
mode: 0644
|
|
|
|
state: present
|
|
|
|
|
2021-07-16 22:44:28 +00:00
|
|
|
- name: Install Java
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.apt:
|
2021-07-16 22:44:28 +00:00
|
|
|
name: "adoptopenjdk-{{ item.java.version }}-hotspot"
|
2021-06-17 02:49:01 +00:00
|
|
|
state: present
|
2021-07-16 22:44:28 +00:00
|
|
|
when: item.java.version is defined
|
2021-06-17 02:49:01 +00:00
|
|
|
loop: "{{ minecraft }}"
|
|
|
|
|
2021-07-16 22:44:28 +00:00
|
|
|
- name: "Install default Java, version {{ minecraft_java }}"
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.apt:
|
2021-07-16 22:44:28 +00:00
|
|
|
name: "{{ minecraft_java_pkg }}"
|
2021-06-17 02:49:01 +00:00
|
|
|
state: present
|
2021-07-16 22:44:28 +00:00
|
|
|
when: item.java.version is not defined
|
2021-06-17 02:49:01 +00:00
|
|
|
loop: "{{ minecraft }}"
|
2021-07-16 22:44:28 +00:00
|
|
|
register: minecraft_java_default
|
2021-06-17 02:49:01 +00:00
|
|
|
|
2021-07-16 22:44:28 +00:00
|
|
|
- name: "Activate default Java, version {{ minecraft_java }}"
|
2023-05-04 03:27:03 +00:00
|
|
|
community.general.alternatives:
|
2021-06-17 02:49:01 +00:00
|
|
|
name: java
|
2021-07-16 22:44:28 +00:00
|
|
|
path: "/usr/lib/jvm/{{ minecraft_java_pkg }}-amd64/bin/java"
|
|
|
|
when: minecraft_java_default.changed
|