diff --git a/.travis.yml b/.travis.yml index 34671b4..d7bd19f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: bionic +dist: jammy language: python python: 3.9 sudo: required @@ -14,19 +14,31 @@ env: - secure: Iw1sHxmjqF6LPywwMPqbogZ47ZnSWPEDq8k71iqKfao0mDtLMUcmF2yIMLC0MQg1akaBKeHBS4MBQVBaGJDz++rgByzVpHwM0S0ZwUiO2ffVQE4uI+JSEMc1R34/5QPkYsg0FSIDVsCZZ9VnRLKh3GnVHlUljwwfVX5UX0g8RDEHxgdYSGGdAt8iUlQ3/YPSkvuKuNPWHtXCM0tkRYByUVUugSwUuo3rolYVv/S8AcrDf9qhHNkrp4zglC31wurq3M0yjmwHnShl+bLj2lV+QAenmFfjAZWlZ3DxARnSWSlFHMT3PGGWHYpFr2BN/na9ZQqmbWcR8k8XKFv6O205M+Zqao1zvzEpWVZBBiBJwYEVekQk1CzpVQ73sitYLHnmPNK5+W4939dNCkKocNhDf/bJTtaU/JlA64418N4hdjBsXTRfhzAILYJ0ba6a8Qnh5Xeuu3EZlRx6JepYEzy5dJel11MgDNVvaC8r9plCYtfo2ew1OH5QcDqCeaU+hTuXB02tNDWQoXP+aInF4JFqxWuEOlpGZeI3lXKNyHADaNBfziwWwtmBqHKhiLn7a8RJSSrVHRY0LS2YfAi5h4R3YwORlPr9E3I8Sgss21X1D2ocOMjZ4Qdfo5/eteUmEqq3yZBzeynrUwoSR7NYzllVWXMLMOoda2kckXNGaD5U7Es= jobs: # Java 8 - - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_VENDOR=adoptopenjdk JDK_MAJOR=8 JDK_VERSION=8u292-b10-3 - DOCKER_TAG_TO_PUBLISH=8u292-bullseye-adoptopenjdk-headless - - DOCKER_IMAGE_BASE=debian:buster-slim JDK_VENDOR=adoptopenjdk JDK_MAJOR=8 JDK_VERSION=8u292-b10-3 - DOCKER_TAG_TO_PUBLISH=8u292-buster-adoptopenjdk-headless + - DOCKER_IMAGE_BASE=debian:bookworm-slim JDK_VENDOR=temurin JDK_MAJOR=8 JDK_VERSION=8.0.382.0.0+5 + DOCKER_TAG_TO_PUBLISH=8u382-bookworm-temurin-jdk + - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_VENDOR=temurin JDK_MAJOR=8 JDK_VERSION=8.0.382.0.0+5 + DOCKER_TAG_TO_PUBLISH=8u382-bullseye-temurin-jdk + - DOCKER_IMAGE_BASE=debian:buster-slim JDK_VENDOR=temurin JDK_MAJOR=8 JDK_VERSION=8.0.382.0.0+5 + DOCKER_TAG_TO_PUBLISH=8u382-buster-temurin-jdk + - DOCKER_IMAGE_BASE=debian:stretch-slim JDK_VENDOR=temurin JDK_MAJOR=8 JDK_VERSION=8.0.322.0.0+6-1 + DOCKER_TAG_TO_PUBLISH=8u322-buster-temurin-jdk - - DOCKER_IMAGE_BASE=ubuntu:bionic JDK_MAJOR=8 JDK_VERSION=8u352-ga-1~18.04 - DOCKER_TAG_TO_PUBLISH=8u352-bionic-openjdk-headless - - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=8 JDK_VERSION=8u352-ga-1~20.04 - DOCKER_TAG_TO_PUBLISH=8u342-focal-openjdk-headless + - DOCKER_IMAGE_BASE=debian:stretch-slim JDK_MAJOR=8 DOCKER_TAG_TO_PUBLISH=8-stretch-openjdk-headless - - DOCKER_IMAGE_BASE=quay.io/centos/centos:stream8 JDK_VENDOR=adoptopenjdk JDK_MAJOR=8 - JDK_VERSION=8u292_b10 DOCKER_TAG_TO_PUBLISH=8u292-centos8-adoptopenjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:bionic JDK_MAJOR=8 JDK_VERSION=8u372-ga~us1-0ubuntu1~18.04 + DOCKER_TAG_TO_PUBLISH=8u372-bionic-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=8 JDK_VERSION=8u382-ga-1~20.04.1 + DOCKER_TAG_TO_PUBLISH=8u382-focal-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:jammy JDK_MAJOR=8 JDK_VERSION=8u382-ga-1~22.04.1 + DOCKER_TAG_TO_PUBLISH=8u382-jammy-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:focal JDK_VENDOR=temurin JDK_MAJOR=8 JDK_VERSION=8.0.382.0.0+5 + DOCKER_TAG_TO_PUBLISH=8u382-focal-temurin-jdk + - DOCKER_IMAGE_BASE=ubuntu:jammy JDK_VENDOR=temurin JDK_MAJOR=8 JDK_VERSION=8.0.382.0.0+5 + DOCKER_TAG_TO_PUBLISH=8u382-jammy-temurin-jdk + + - DOCKER_IMAGE_BASE=debian:bookworm-slim JDK_VENDOR=corretto JDK_MAJOR=1.8.0 JDK_VERSION=1:8.302.08-1 + DOCKER_TAG_TO_PUBLISH=8u302-bookworm-corretto-headless - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_VENDOR=corretto JDK_MAJOR=1.8.0 JDK_VERSION=1:8.302.08-1 DOCKER_TAG_TO_PUBLISH=8u302-bullseye-corretto-headless - DOCKER_IMAGE_BASE=debian:buster-slim JDK_VENDOR=corretto JDK_MAJOR=1.8.0 JDK_VERSION=1:8.302.08-1 @@ -41,14 +53,29 @@ env: - DOCKER_IMAGE_BASE=debian:bullseye-slim DOCKER_TAG_TO_PUBLISH=11-bullseye-openjdk-headless - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_MAJOR=11 JDK_VERSION=11.0.18+10-1~deb11u1 DOCKER_TAG_TO_PUBLISH=11.0.18-bullseye-openjdk-headless + - DOCKER_IMAGE_BASE=debian:bookworm-slim DOCKER_TAG_TO_PUBLISH=11-bookworm-openjdk-headless - - DOCKER_IMAGE_BASE=ubuntu:bionic DOCKER_TAG_TO_PUBLISH=11-bionic-openjdk-headless - - DOCKER_IMAGE_BASE=ubuntu:bionic JDK_MAJOR=11 JDK_VERSION=11.0.17+8-1ubuntu2~18.04 - DOCKER_TAG_TO_PUBLISH=11.0.17-bionic-openjdk-headless + - DOCKER_IMAGE_BASE=debian:buster-slim JDK_MAJOR=11 JDK_VENDOR=temurin JDK_VERSION=11.0.20.0.0+8 + DOCKER_TAG_TO_PUBLISH=11.0.20-buster-temurin-jdk + - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_MAJOR=11 JDK_VENDOR=temurin JDK_VERSION=11.0.20.0.0+8 + DOCKER_TAG_TO_PUBLISH=11.0.20-bullseye-temurin-jdk + - DOCKER_IMAGE_BASE=debian:bookworm-slim JDK_MAJOR=11 JDK_VENDOR=temurin JDK_VERSION=11.0.20.0.0+8 + DOCKER_TAG_TO_PUBLISH=11.0.20-bookworm-temurin-jdk + - DOCKER_IMAGE_BASE=ubuntu:bionic DOCKER_TAG_TO_PUBLISH=11-bionic-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:bionic JDK_MAJOR=11 JDK_VERSION=11.0.19+7~us1-0ubuntu1~18.04.1 + DOCKER_TAG_TO_PUBLISH=11.0.19-bionic-openjdk-headless - DOCKER_IMAGE_BASE=ubuntu:focal DOCKER_TAG_TO_PUBLISH=11-focal-openjdk-headless - - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=11 JDK_VERSION=11.0.17+8-1ubuntu2~20.04 - DOCKER_TAG_TO_PUBLISH=11.0.17-focal-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=11 JDK_VERSION=11.0.20+8-1ubuntu1~20.04 + DOCKER_TAG_TO_PUBLISH=11.0.20-focal-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:jammy DOCKER_TAG_TO_PUBLISH=11-jammy-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:jammy JDK_MAJOR=11 JDK_VERSION=11.0.20+8-1ubuntu1~22.04 + DOCKER_TAG_TO_PUBLISH=11.0.20-jammy-openjdk-headless + + - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=11 JDK_VENDOR=temurin JDK_VERSION=11.0.20.0.0+8 + DOCKER_TAG_TO_PUBLISH=11.0.20-focal-temurin-jdk + - DOCKER_IMAGE_BASE=ubuntu:jammy JDK_MAJOR=11 JDK_VENDOR=temurin JDK_VERSION=11.0.20.0.0+8 + DOCKER_TAG_TO_PUBLISH=11.0.20-jammy-temurin-jdk - DOCKER_IMAGE_BASE=centos:7 JDK_MAJOR=11 JDK_VERSION=11.0.12.0.7 DOCKER_TAG_TO_PUBLISH=11.0.12.0.7-centos7-openjdk-headless - DOCKER_IMAGE_BASE=quay.io/centos/centos:stream8 JDK_MAJOR=11 JDK_VERSION=11.0.13.0.8 @@ -59,12 +86,26 @@ env: # Java 17 - DOCKER_IMAGE_BASE=debian:bullseye-slim DOCKER_TAG_TO_PUBLISH=17-bullseye-openjdk-headless - - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_MAJOR=17 JDK_VERSION=17.0.6+10-1~deb11u1 - DOCKER_TAG_TO_PUBLISH=17.0.6-bullseye-openjdk-headless + - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_MAJOR=17 JDK_VERSION=17.0.7+7-1~deb11u1 + DOCKER_TAG_TO_PUBLISH=17.0.7-bullseye-openjdk-headless + - DOCKER_IMAGE_BASE=debian:bookworm-slim JDK_MAJOR=17 JDK_VERSION=17.0.8+7-1~deb12u1 + DOCKER_TAG_TO_PUBLISH=17.0.8-bookworm-openjdk-headless + + - DOCKER_IMAGE_BASE=debian:bullseye-slim JDK_MAJOR=17 JDK_VENDOR=temurin JDK_VERSION=17.0.8.0.0+7 + DOCKER_TAG_TO_PUBLISH=17.0.8-bullseye-temurin-jdk + - DOCKER_IMAGE_BASE=debian:bookworm-slim JDK_MAJOR=17 JDK_VENDOR=temurin JDK_VERSION=17.0.8.0.0+7 + DOCKER_TAG_TO_PUBLISH=17.0.8-bookworm-temurin-jdk - DOCKER_IMAGE_BASE=ubuntu:focal DOCKER_TAG_TO_PUBLISH=17-focal-openjdk-headless - - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=17 JDK_VERSION=17.0.5+8-2ubuntu1~20.04 - DOCKER_TAG_TO_PUBLISH=17.0.5-focal-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=17 JDK_VERSION=17.0.8+7-1~20.04.2 + DOCKER_TAG_TO_PUBLISH=17.0.8-focal-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:jammy DOCKER_TAG_TO_PUBLISH=17-jammy-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:jammy JDK_MAJOR=17 JDK_VERSION=17.0.8+7-1~22.04 + DOCKER_TAG_TO_PUBLISH=17.0.8-jammy-openjdk-headless + - DOCKER_IMAGE_BASE=ubuntu:focal JDK_MAJOR=17 JDK_VENDOR=temurin JDK_VERSION=17.0.8.0.0+7 + DOCKER_TAG_TO_PUBLISH=17.0.8-focal-temurin-jdk + - DOCKER_IMAGE_BASE=ubuntu:jammy JDK_MAJOR=17 JDK_VENDOR=temurin JDK_VERSION=17.0.8.0.0+7 + DOCKER_TAG_TO_PUBLISH=17.0.8-jammy-temurin-jdk script: - pipenv run molecule test --scenario-name=${JDK_VENDOR:-default} diff --git a/.yamllint b/.yamllint index 2d346b3..bb151ec 100644 --- a/.yamllint +++ b/.yamllint @@ -12,7 +12,6 @@ rules: # NOTE(retr0h): Templates no longer fail this lint rule. # Uncomment if running old Molecule templates. # truthy: disable - ignore: | tests/ .travis.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bdc6e0..ab33e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ## [Unreleased](https://github.com/idealista/java_role/tree/develop) +## [9.0.0](https://github.com/idealista/java_role/tree/9.0.0) (2023-08-16) +### Added +- *[#210](https://github.com/idealista/java_role/issues/210) Temurin support* @sorobon +- *[#210](https://github.com/idealista/java_role/issues/210) Debian 12 support* @sorobon +- *[#210](https://github.com/idealista/java_role/issues/210) Remove deprecated repositories* @sorobon +### Removed +- *[#210](https://github.com/idealista/java_role/issues/210) Removed adoptopenjdk* @sorobon + ## [8.1.0](https://github.com/idealista/java_role/tree/8.1.0) (2023-06-22) ### Added - *[#207](https://github.com/idealista/java_role/issues/207) Add support for import SSL certificates into Java's truststore* @emepege diff --git a/README.md b/README.md index 0a047e8..93ecd61 100644 --- a/README.md +++ b/README.md @@ -108,14 +108,17 @@ Debian Stretch | `11` Debian Buster | `11` (default) Debian Bullseye | `17` Debian Bullseye | `11` (default) +Debian Bookworm | `17` +Debian Bookworm | `17` (default) Ubuntu Xenial | `8` Ubuntu Xenial | `9` (default) Ubuntu Bionic | `8` Ubuntu Bionic | `11` (default) Ubuntu Focal | `8` Ubuntu Focal | `11` -Ubuntu Focal | `13` -Ubuntu Focal | `14` (default) +Ubuntu Focal | `17` (default) +Ubuntu Jammy | `11` +Ubuntu Jammy | `17` (default) CentOS 7 | `1.6.0` CentOS 7 | `1.7.0` CentOS 7 | `1.8.0` @@ -123,7 +126,7 @@ CentOS 7 | `11` (default) CentOS 8 | `1.8.0` CentOS 8 | `11` (default) -Other OpenJDK implementations out of GNU/Linux distributions streams are not officially supported, but it's easy use this role too adding extra repositories (see vars/ in AdoptOpenJDK and Corretto directories). +Other OpenJDK implementations out of GNU/Linux distributions streams are not officially supported, but it's easy use this role too adding extra repositories (see vars/ in AdoptOpenJDK/Temurin and Corretto directories). ### Adding certificates into Java's truststore diff --git a/meta/main.yml b/meta/main.yml index 09ffef9..fc57d5e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -9,8 +9,10 @@ galaxy_info: platforms: - name: Debian versions: + - stretch - buster - bullseye + - bookworm - name: Ubuntu versions: - bionic diff --git a/molecule/adoptopenjdk/Dockerfile.j2 b/molecule/adoptopenjdk/Dockerfile.j2 deleted file mode 100644 index 5dbc587..0000000 --- a/molecule/adoptopenjdk/Dockerfile.j2 +++ /dev/null @@ -1,15 +0,0 @@ -# Molecule managed - -{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -RUN mkdir -p /usr/share/man/man1 - -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python3 sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python36 sudo python3-dnf bash && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index 8e3be40..25c6350 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -9,6 +9,18 @@ FROM {{ item.image }} RUN mkdir -p /usr/share/man/man1 RUN if [ $(command -v apt-get) ]; then sed -i -e 's/^APT/# APT/' -e 's/^DPkg/# DPkg/' /etc/apt/apt.conf.d/docker-clean; fi +{% if 'stretch' in item.image %} +RUN echo "deb http://archive.debian.org/debian/ stretch contrib main non-free" > /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch contrib main non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list && \ + apt-get update +{% endif %} + RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python3 sudo bash ca-certificates && apt-get clean; \ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python36 sudo python3-dnf bash && dnf clean all; \ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ diff --git a/molecule/temurin/Dockerfile.j2 b/molecule/temurin/Dockerfile.j2 new file mode 100644 index 0000000..ce3b9d8 --- /dev/null +++ b/molecule/temurin/Dockerfile.j2 @@ -0,0 +1,27 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN mkdir -p /usr/share/man/man1 + +{% if 'stretch' in item.image %} +RUN echo "deb http://archive.debian.org/debian/ stretch contrib main non-free" > /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch contrib main non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list && \ + apt-get update +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python3 sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python36 sudo python3-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi diff --git a/molecule/adoptopenjdk/converge.yml b/molecule/temurin/converge.yml similarity index 100% rename from molecule/adoptopenjdk/converge.yml rename to molecule/temurin/converge.yml diff --git a/molecule/adoptopenjdk/molecule.yml b/molecule/temurin/molecule.yml similarity index 90% rename from molecule/adoptopenjdk/molecule.yml rename to molecule/temurin/molecule.yml index 7251d4c..31f8a58 100644 --- a/molecule/adoptopenjdk/molecule.yml +++ b/molecule/temurin/molecule.yml @@ -9,7 +9,7 @@ lint: | ansible-lint . platforms: - - name: openjdk-adopt-test + - name: temurin-test groups: - openjdk image: ${DOCKER_IMAGE_BASE:-debian:buster-slim} @@ -25,6 +25,6 @@ provisioner: java_open_jdk_version_major: ${JDK_MAJOR} scenario: - name: adoptopenjdk + name: temurin verifier: name: ansible diff --git a/molecule/adoptopenjdk/tests/test_openjdk.yml b/molecule/temurin/tests/test_openjdk.yml similarity index 100% rename from molecule/adoptopenjdk/tests/test_openjdk.yml rename to molecule/temurin/tests/test_openjdk.yml diff --git a/molecule/adoptopenjdk/verify.yml b/molecule/temurin/verify.yml similarity index 98% rename from molecule/adoptopenjdk/verify.yml rename to molecule/temurin/verify.yml index 6dc75cd..53d888f 100644 --- a/molecule/adoptopenjdk/verify.yml +++ b/molecule/temurin/verify.yml @@ -25,7 +25,7 @@ tasks: - name: Set JDK Vendor set_fact: - java_jdk_vendor: adoptopenjdk + java_jdk_vendor: temurin - name: Gather OS specific variables include_vars: "../../vars/{{ java_jdk_vendor }}/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" diff --git a/tasks/install_openjdk.yml b/tasks/install_openjdk.yml index 5e4dc4b..78eb8a8 100644 --- a/tasks/install_openjdk.yml +++ b/tasks/install_openjdk.yml @@ -1,5 +1,10 @@ --- +- name: Java | Migrate adoptopenjdk to temurin (if selected) + set_fact: + java_jdk_vendor: "temurin" + when: "java_jdk_vendor == 'adoptopenjdk'" + - name: Java | Gather OS specific variables include_vars: "{{ item }}" with_first_found: @@ -18,6 +23,7 @@ java_required_repositories_openjdk: "{{ java_required_repositories_openjdk if java_required_repositories_openjdk is defined and java_required_repositories_openjdk is not sameas None and java_required_repositories_openjdk | length else __java_required_repositories_openjdk }}" java_required_key_repositories_openjdk: "{{ java_required_key_repositories_openjdk if java_required_key_repositories_openjdk is defined and java_required_key_repositories_openjdk is not sameas None and java_required_key_repositories_openjdk | length else __java_required_key_repositories_openjdk }}" java_required_libs_openjdk: "{{ java_required_libs_openjdk if java_required_libs_openjdk is defined and java_required_libs_openjdk is not sameas None and java_required_libs_openjdk | length else __java_required_libs_openjdk }}" + java_deprecated_repositories_adoptopenjdk: "{{ java_deprecated_repositories_adoptopenjdk if java_deprecated_repositories_adoptopenjdk is defined and java_deprecated_repositories_adoptopenjdk is not sameas None and java_deprecated_repositories_adoptopenjdk | length else __java_deprecated_repositories_adoptopenjdk }}" - name: Java | Setting OS and architecture specific variables (II) set_fact: @@ -30,6 +36,12 @@ - name: Java | Debian pre-requisites block: + - name: Java | Remove deprecated repositories + apt_repository: + repo: "{{ item }}" + state: absent + with_items: "{{ java_deprecated_repositories_adoptopenjdk }}" + when: java_deprecated_repositories_adoptopenjdk | length > 0 - name: Java | Install extra apt tools package: name: "{{ java_open_jdk_apt_extra_packages }}" @@ -109,9 +121,19 @@ tags: - skip_ansible_lint -- name: Correct java version selected /usr/lib/jvm/{{ java_open_jdk_home_dir }}/jre/bin/java" +- name: "Correct java version selected /usr/lib/jvm/{{ java_open_jdk_home_dir }}/jre/bin/java in java < 11" alternatives: name: java path: "/usr/lib/jvm/{{ java_open_jdk_home_dir }}/jre/bin/java" - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' + - java_open_jdk_version_major | int < 11 + +- name: "Correct java version selected /usr/lib/jvm/{{ java_open_jdk_home_dir }}/bin/java in java >= 11" + alternatives: + name: java + path: "/usr/lib/jvm/{{ java_open_jdk_home_dir }}/bin/java" + when: + - ansible_os_family == 'Debian' + - java_open_jdk_version_major | int >= 11 diff --git a/vars/adoptopenjdk/CentOS-8.yml b/vars/adoptopenjdk/CentOS-8.yml deleted file mode 100644 index d85b0b8..0000000 --- a/vars/adoptopenjdk/CentOS-8.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -java_open_jdk_apt_extra_packages: [] -__java_open_jdk_version_major: 8 -__java_keystore_dir: jre/lib/security -# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations - -__java_required_repositories_openjdk: - - { name: "AdoptOpenJDK", baseurl: "http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch" } -__java_required_libs_openjdk: [] -__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot - -__java_required_key_repositories_openjdk: - - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public -__java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot diff --git a/vars/corretto/CentOS-8.yml b/vars/corretto/CentOS-8.yml index f56374f..6d1e44e 100644 --- a/vars/corretto/CentOS-8.yml +++ b/vars/corretto/CentOS-8.yml @@ -12,3 +12,4 @@ __java_open_jdk_package: java-{{ java_open_jdk_version_major }}-amazon-corretto- __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-amazon-corretto __java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }} +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/corretto/Debian-10.yml b/vars/corretto/Debian-10.yml index b475bb4..a488bb6 100644 --- a/vars/corretto/Debian-10.yml +++ b/vars/corretto/Debian-10.yml @@ -15,3 +15,4 @@ __java_required_libs_openjdk: [] __java_open_jdk_package: java-{{ java_open_jdk_version_major }}-amazon-corretto-jdk __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-amazon-corretto +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/corretto/Debian-11.yml b/vars/corretto/Debian-11.yml index 737ceca..9c5bf9b 100644 --- a/vars/corretto/Debian-11.yml +++ b/vars/corretto/Debian-11.yml @@ -16,3 +16,4 @@ __java_required_libs_openjdk: [] __java_open_jdk_package: java-{{ java_open_jdk_version_major }}-amazon-corretto-jdk __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-amazon-corretto +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/corretto/Debian-12.yml b/vars/corretto/Debian-12.yml new file mode 100644 index 0000000..9c5bf9b --- /dev/null +++ b/vars/corretto/Debian-12.yml @@ -0,0 +1,19 @@ +--- +java_open_jdk_apt_extra_packages: + - python3-apt + - apt-transport-https + - gnupg2 + +__java_open_jdk_version_major: 1.8.0 +__java_keystore_dir: jre/lib/security +# Supported versions: 8 (1.8.0L), 11 + +__java_required_repositories_openjdk: + - deb https://apt.corretto.aws stable main +__java_required_key_repositories_openjdk: + - https://apt.corretto.aws/corretto.key +__java_required_libs_openjdk: [] +__java_open_jdk_package: java-{{ java_open_jdk_version_major }}-amazon-corretto-jdk + +__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-amazon-corretto +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/openjdk/CentOS-7.yml b/vars/openjdk/CentOS-7.yml index bc5ed94..947caa8 100644 --- a/vars/openjdk/CentOS-7.yml +++ b/vars/openjdk/CentOS-7.yml @@ -11,3 +11,4 @@ __java_required_key_repositories_openjdk: [] __java_open_jdk_package: "java-{{ java_open_jdk_version_major }}-openjdk-headless" __java_open_jdk_home_dir: "jre-{{ java_open_jdk_version_major }}" +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/openjdk/CentOS-8.yml b/vars/openjdk/CentOS-8.yml index 814f539..1660379 100644 --- a/vars/openjdk/CentOS-8.yml +++ b/vars/openjdk/CentOS-8.yml @@ -11,3 +11,4 @@ __java_required_key_repositories_openjdk: [] __java_open_jdk_package: "java-{{ java_open_jdk_version_major }}-openjdk-headless" __java_open_jdk_home_dir: "jre-{{ java_open_jdk_version_major }}" +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/openjdk/Debian-10.yml b/vars/openjdk/Debian-10.yml index 655753d..d08d0e1 100644 --- a/vars/openjdk/Debian-10.yml +++ b/vars/openjdk/Debian-10.yml @@ -11,3 +11,5 @@ __java_required_key_repositories_openjdk: [] __java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/openjdk/Debian-11.yml b/vars/openjdk/Debian-11.yml index 01c74d9..9c71317 100644 --- a/vars/openjdk/Debian-11.yml +++ b/vars/openjdk/Debian-11.yml @@ -14,3 +14,5 @@ __java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} ansible_python_interpreter: /usr/bin/python3 +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/openjdk/Debian-12.yml b/vars/openjdk/Debian-12.yml new file mode 100644 index 0000000..d4a9fe9 --- /dev/null +++ b/vars/openjdk/Debian-12.yml @@ -0,0 +1,18 @@ +--- + +# Using pattern described in Ansible Best Practices and Conventions (Appendix B), Ansible for Devops (p. 406) +__java_open_jdk_version_major: 17 +__java_keystore_dir: lib/security +# Supported openjdk major releases: 11, 17 + +__java_required_repositories_openjdk: [] +__java_required_libs_openjdk: [] +__java_required_key_repositories_openjdk: [] +__java_open_jdk_apt_extra_packages: [] + +__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless +__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} + +ansible_python_interpreter: /usr/bin/python3 +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/openjdk/Debian-9.yml b/vars/openjdk/Debian-9.yml new file mode 100644 index 0000000..2cafcec --- /dev/null +++ b/vars/openjdk/Debian-9.yml @@ -0,0 +1,15 @@ +--- + +# Using pattern described in Ansible Best Practices and Conventions (Appendix B), Ansible for Devops (p. 406) +__java_open_jdk_version_major: 11 +__java_keystore_dir: lib/security +# Supported openjdk major releases: 11 + +__java_required_repositories_openjdk: "deb http://archive.debian.org/debian stretch-backports main" +__java_required_libs_openjdk: [] +__java_required_key_repositories_openjdk: [] + +__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless +__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/openjdk/Ubuntu-18.yml b/vars/openjdk/Ubuntu-18.yml index 3e5a29a..4245937 100644 --- a/vars/openjdk/Ubuntu-18.yml +++ b/vars/openjdk/Ubuntu-18.yml @@ -15,3 +15,4 @@ __java_required_key_repositories_openjdk: [] __java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/openjdk/Ubuntu-20.yml b/vars/openjdk/Ubuntu-20.yml index 9fbba5a..86e30dd 100644 --- a/vars/openjdk/Ubuntu-20.yml +++ b/vars/openjdk/Ubuntu-20.yml @@ -14,3 +14,4 @@ __java_required_key_repositories_openjdk: [] __java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/openjdk/Ubuntu-22.yml b/vars/openjdk/Ubuntu-22.yml index d9a187e..9709921 100644 --- a/vars/openjdk/Ubuntu-22.yml +++ b/vars/openjdk/Ubuntu-22.yml @@ -14,3 +14,4 @@ __java_required_key_repositories_openjdk: [] __java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless __java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ java_open_jdk_home_dir_suffix }} +__java_deprecated_repositories_adoptopenjdk: [] diff --git a/vars/adoptopenjdk/Debian-10.yml b/vars/temurin/Debian-10.yml similarity index 54% rename from vars/adoptopenjdk/Debian-10.yml rename to vars/temurin/Debian-10.yml index 8506b3c..878a361 100644 --- a/vars/adoptopenjdk/Debian-10.yml +++ b/vars/temurin/Debian-10.yml @@ -8,9 +8,12 @@ __java_keystore_dir: jre/lib/security # For Debian family __java_required_libs_openjdk: [] + +__java_required_key_repositories_openjdk: + - https://packages.adoptium.net/artifactory/api/gpg/key/public __java_required_repositories_openjdk: + - deb https://packages.adoptium.net/artifactory/deb {{ ansible_distribution_release }} main +__java_open_jdk_home_dir: temurin-{{ java_open_jdk_version_major }}-jdk-{{ java_open_jdk_home_dir_suffix }} +__java_open_jdk_package: temurin-{{ java_open_jdk_version_major }}-jdk +__java_deprecated_repositories_adoptopenjdk: - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main -__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-{{ java_open_jdk_home_dir_suffix }} -__java_required_key_repositories_openjdk: - - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public -__java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot diff --git a/vars/adoptopenjdk/Debian-11.yml b/vars/temurin/Debian-11.yml similarity index 55% rename from vars/adoptopenjdk/Debian-11.yml rename to vars/temurin/Debian-11.yml index d094df8..a1ee22a 100644 --- a/vars/adoptopenjdk/Debian-11.yml +++ b/vars/temurin/Debian-11.yml @@ -9,10 +9,11 @@ __java_keystore_dir: jre/lib/security # For Debian family __java_required_libs_openjdk: [] +__java_required_key_repositories_openjdk: + - https://packages.adoptium.net/artifactory/api/gpg/key/public __java_required_repositories_openjdk: + - deb https://packages.adoptium.net/artifactory/deb {{ ansible_distribution_release }} main +__java_open_jdk_home_dir: temurin-{{ java_open_jdk_version_major }}-jdk-{{ java_open_jdk_home_dir_suffix }} +__java_open_jdk_package: temurin-{{ java_open_jdk_version_major }}-jdk +__java_deprecated_repositories_adoptopenjdk: - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main -__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-{{ java_open_jdk_home_dir_suffix }} - -__java_required_key_repositories_openjdk: - - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public -__java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot diff --git a/vars/temurin/Debian-12.yml b/vars/temurin/Debian-12.yml new file mode 100644 index 0000000..a1ee22a --- /dev/null +++ b/vars/temurin/Debian-12.yml @@ -0,0 +1,19 @@ +--- +java_open_jdk_apt_extra_packages: + - python3-apt + - apt-transport-https + - gnupg2 +__java_open_jdk_version_major: 8 +__java_keystore_dir: jre/lib/security +# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations + +# For Debian family +__java_required_libs_openjdk: [] +__java_required_key_repositories_openjdk: + - https://packages.adoptium.net/artifactory/api/gpg/key/public +__java_required_repositories_openjdk: + - deb https://packages.adoptium.net/artifactory/deb {{ ansible_distribution_release }} main +__java_open_jdk_home_dir: temurin-{{ java_open_jdk_version_major }}-jdk-{{ java_open_jdk_home_dir_suffix }} +__java_open_jdk_package: temurin-{{ java_open_jdk_version_major }}-jdk +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/temurin/Debian-9.yml b/vars/temurin/Debian-9.yml new file mode 100644 index 0000000..878a361 --- /dev/null +++ b/vars/temurin/Debian-9.yml @@ -0,0 +1,19 @@ +--- +java_open_jdk_apt_extra_packages: + - python-apt + - apt-transport-https +__java_open_jdk_version_major: 8 +__java_keystore_dir: jre/lib/security +# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations + +# For Debian family +__java_required_libs_openjdk: [] + +__java_required_key_repositories_openjdk: + - https://packages.adoptium.net/artifactory/api/gpg/key/public +__java_required_repositories_openjdk: + - deb https://packages.adoptium.net/artifactory/deb {{ ansible_distribution_release }} main +__java_open_jdk_home_dir: temurin-{{ java_open_jdk_version_major }}-jdk-{{ java_open_jdk_home_dir_suffix }} +__java_open_jdk_package: temurin-{{ java_open_jdk_version_major }}-jdk +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/temurin/Ubuntu-20.yml b/vars/temurin/Ubuntu-20.yml new file mode 100644 index 0000000..fad294b --- /dev/null +++ b/vars/temurin/Ubuntu-20.yml @@ -0,0 +1,18 @@ +--- +java_open_jdk_apt_extra_packages: + - python3-apt + - apt-transport-https + - gnupg2 +__java_open_jdk_version_major: 8 +__java_keystore_dir: jre/lib/security +# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations + +__java_required_libs_openjdk: [] +__java_required_key_repositories_openjdk: + - https://packages.adoptium.net/artifactory/api/gpg/key/public +__java_required_repositories_openjdk: + - deb https://packages.adoptium.net/artifactory/deb {{ ansible_distribution_release }} main +__java_open_jdk_home_dir: temurin-{{ java_open_jdk_version_major }}-jdk-{{ java_open_jdk_home_dir_suffix }} +__java_open_jdk_package: temurin-{{ java_open_jdk_version_major }}-jdk +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main diff --git a/vars/temurin/Ubuntu-22.yml b/vars/temurin/Ubuntu-22.yml new file mode 100644 index 0000000..fad294b --- /dev/null +++ b/vars/temurin/Ubuntu-22.yml @@ -0,0 +1,18 @@ +--- +java_open_jdk_apt_extra_packages: + - python3-apt + - apt-transport-https + - gnupg2 +__java_open_jdk_version_major: 8 +__java_keystore_dir: jre/lib/security +# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations + +__java_required_libs_openjdk: [] +__java_required_key_repositories_openjdk: + - https://packages.adoptium.net/artifactory/api/gpg/key/public +__java_required_repositories_openjdk: + - deb https://packages.adoptium.net/artifactory/deb {{ ansible_distribution_release }} main +__java_open_jdk_home_dir: temurin-{{ java_open_jdk_version_major }}-jdk-{{ java_open_jdk_home_dir_suffix }} +__java_open_jdk_package: temurin-{{ java_open_jdk_version_major }}-jdk +__java_deprecated_repositories_adoptopenjdk: + - deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main