Update the Zulu tasks.

This commit is contained in:
Andrea Dell'Amico 2021-09-24 18:44:08 +02:00
parent af38351e94
commit 60804df109
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 33 additions and 14 deletions

View File

@ -10,23 +10,25 @@ dismissed_openjdk_ppa: 'ppa:openjdk-r/ppa'
openjdk_force_system_jdk_on_trusty: False
openjdk_zulu_repo_install: False
openjdk_zulu_repo_key_id: '0xB1998361219BD9C9'
openjdk_zulu_repository: 'deb http://repos.azulsystems.com/{{ ansible_distribution | lower }} stable main'
openjdk_zulu_repository: 'https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-2_all.deb'
openjdk_zulu_repository_deb: 'zulu-repo'
openjdk_java_home: '/usr/lib/jvm/java-{{ openjdk_default }}-openjdk-amd64'
jdk_java_home: '{{ openjdk_java_home }}'
# jdk_java_home: '/usr/lib/jvm/java'
openjdk_zulu_java_home: '/usr/lib/jvm/zulu{{ openjdk_default }}'
openjdk_zulu_java_home: '/usr/lib/jvm/zulu{{ openjdk_default }}-ca-amd64'
openjdk_zulu_package_name: zulu
openjdk_zulu_pkgs:
- '{{ openjdk_zulu_package_name }}-{{ openjdk_default }}'
- '{{ openjdk_zulu_package_name }}{{ openjdk_default }}-ca-jre-headless'
- '{{ openjdk_zulu_package_name }}{{ openjdk_default }}-ca-jdk-headless'
# Set to '' when installing the non headless version
openjdk_zulu_alternatives_options: '--jre-headless'
openjdk_pkgs:
- jre-headless
- jdk-headless
- jre-headless
- jdk-headless
# - jre
# - jdk
# This one we remove
oracle_jdk_ubuntu_ppa: 'ppa:webupd8team/java'
openjdk_oracle_jdk_pkgs:
- oracle-java7-installer
- oracle-java7-set-default
@ -34,7 +36,7 @@ openjdk_oracle_jdk_pkgs:
- oracle-java8-installer
- oracle-java8-set-default
- oracle-java8-unlimited-jce-policy
openjdk_el_default_version: '1.{{ openjdk_default }}.0'
openjdk_el_version:
- '{{ openjdk_el_default_version }}'
@ -48,3 +50,6 @@ openjdk_el_pkgs:
openjdk_commands:
- java
- javac
# This one we remove
oracle_jdk_ubuntu_ppa: 'ppa:webupd8team/java'

View File

@ -20,14 +20,19 @@
apt_key: keyserver='hkp://keyserver.ubuntu.com' id={{ openjdk_zulu_repo_key_id }}
- name: Install the proper Zulu repository
apt_repository: repo='{{ openjdk_zulu_repository }}' update_cache=yes
apt:
deb: '{{ openjdk_zulu_repository }}'
update_cache: yes
- name: Install the Zulu OpenJDK
apt: pkg={{ openjdk_zulu_pkgs }} state={{ openjdk_pkg_state }} update_cache=yes cache_valid_time=3600
- name: Install the Zulu OpenJDK
apt:
pkg: '{{ openjdk_zulu_pkgs }}'
state: '{{ openjdk_pkg_state }}'
update_cache: yes
register: openjdk_installed
- name: Set the default OpenJDK as Zulu
shell: update-java-alternatives -s /usr/lib/jvm/zulu-{{ openjdk_default }}-amd64
shell: update-java-alternatives {{ openjdk_zulu_alternatives_options }} -s {{ openjdk_zulu_java_home }}
when: openjdk_installed is changed
- name: Set the correct value for jdk_java_home when we are installing Zulu
@ -38,8 +43,17 @@
tags: [ 'jdk', 'openjdk' ]
- block:
- name: Remove the Zulu repository if it is present
apt_repository: repo='{{ openjdk_zulu_repository }}' update_cache=yes state=absent
- name: Remove the Zulu repository package if it is present
apt:
pkg: '{{ openjdk_zulu_repository_deb }}'
state: absent
update_cache: yes
- name: Remove the Zulu repository configuration
file:
dest: /etc/apt/sources.list.d/zulu-openjdk.list
state: absent
update_cache: yes
- name: Install the OpenJDK that comes with the distribution
apt: pkg=openjdk-{{ item.0 }}-{{ item[1] }} state={{ openjdk_pkg_state }} update_cache=yes cache_valid_time=3600