- name: Install GPG apt: name: gpg state: present when: item.java is defined and item.java == 8 loop: "{{ minecraft }}" - name: Add AdoptOpenJDK's signing key apt_key: id: 8ED17AF5D7E675EB3EE3BCE98AC3B29174885C03 url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public when: item.java is defined and item.java == 8 loop: "{{ minecraft }}" - name: Install AdoptOpenJDK repository apt_repository: repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main mode: 0644 state: present when: item.java is defined and item.java == 8 loop: "{{ minecraft }}" - name: Install Java 8 apt: name: adoptopenjdk-8-hotspot state: present when: item.java is defined and item.java == 8 loop: "{{ minecraft }}" - name: Install Java 11 apt: name: openjdk-11-jre state: present when: item.java is not defined or item.java == 11 loop: "{{ minecraft }}" - name: Activate Java 8 alternatives: name: java path: /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/jre/bin/java when: minecraft_java == 8 - name: Activate Java 11 alternatives: name: java path: /usr/lib/jvm/java-11-openjdk-amd64/bin/java when: minecraft_java == 11