diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bbd73e4a..134f9dd8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,9 @@ --- # Run all tests +default: + image: + name: leandelivery/docker-ansible-ci:ansible-2.9 + stages: - lint - deployment test @@ -27,350 +31,366 @@ Lint: - lint Docker java-on-defaults: - stage: deployment test - script: - - molecule test -s default - tags: - - aws + stage: deployment test + script: + - molecule test -s default + tags: + - aws AWS java-6: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-direct-6 - tags: - - aws - -AWS java-7: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-direct-7 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-direct-6 + tags: + - aws + +.AWS java-7: + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-direct-7 + tags: + - aws AWS java-8: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-direct-8 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-direct-8 + tags: + - aws # Windows tests are preferrably run in Azure .AWS java-8 Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-8 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-8 + tags: + - aws AZURE java-8 Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-8 - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-windows-8 + tags: + - azure # Windows tests are preferrably run in Azure .AWS openjdk-13 Windows chocolatey: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-openjdk13-chocolatey - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-openjdk13-chocolatey + tags: + - aws # Windows tests are preferrably run in Azure -.AZURE openjdk-13 Windows chocolatey: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-openjdk13-chocolatey - tags: - - azure +AZURE openjdk-13 Windows chocolatey: + stage: deployment test + script: + - molecule test -s cloud-azure-windows-openjdk13-chocolatey + tags: + - azure AWS java-11: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-direct-11 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-direct-11 + tags: + - aws AWS openjdk-8: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-openjdk-8 - tags: - - aws - -.AWS openjdk-11: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-openjdk-11 - tags: - - aws - -AWS openjdk-12: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-openjdk-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-openjdk-8 + tags: + - aws + +AWS openjdk-11: + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-openjdk-11 + tags: + - aws + +.AWS openjdk-12: + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-openjdk-12 + tags: + - aws AWS openjdk-ga: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-openjdk-ga - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-openjdk-ga + tags: + - aws # Windows tests are preferrably run in Azure .AWS openjdk-ga Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-openjdk-windows-ga - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-openjdk-windows-ga + tags: + - aws AZURE openjdk-ga Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-openjdk-windows-ga - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-openjdk-windows-ga + tags: + - azure # Windows tests are preferrably run in Azure .AWS java-11 Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-11 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-11 + tags: + - aws AZURE java-11 Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-11 - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-windows-11 + tags: + - azure AWS java-12: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-direct-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-direct-12 + tags: + - aws # Windows tests are preferrably run in Azure .AWS java-12 Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-12 + tags: + - aws AZURE java-12 Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-12 - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-windows-12 + tags: + - azure AWS sapjvm-8: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-sapjvm-8 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-sapjvm-8 + tags: + - aws # Windows tests are preferrably run in Azure .AWS sapjvm-8 Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-sapjvm-8 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-sapjvm-8 + tags: + - aws AZURE sapjvm-8 Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-sapjvm-8 - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-windows-sapjvm-8 + tags: + - azure AWS zulu-12: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-zulu-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-zulu-12 + tags: + - aws # Windows tests are preferrably run in Azure .AWS zulu-12 Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-zulu-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-zulu-12 + tags: + - aws # Windows tests are preferrably run in Azure .AWS zulu-12 Windows chocolatey: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-windows-zulu12-chocolatey - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-windows-zulu12-chocolatey + tags: + - aws AZURE zulu-12 Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-zulu-12 - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-windows-zulu-12 + tags: + - azure AZURE zulu-12 Windows chocolatey: - stage: deployment test - script: - - molecule test -s cloud-azure-windows-zulu12-chocolatey - tags: - - azure - -.EPC java-8: - variables: - EPC_REGION: EPAM-BY2 - stage: deployment test - script: - - molecule test -s cloud-epc-delegated - tags: - - delegated + stage: deployment test + script: + - molecule test -s cloud-azure-windows-zulu12-chocolatey + tags: + - azure AWS adoptopenjdk-8: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-adoptopenjdk-8 - tags: - - aws - -.AWS adoptopenjdk-11: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-adoptopenjdk-11 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-adoptopenjdk-8 + tags: + - aws + +AWS adoptopenjdk-11: + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-adoptopenjdk-11 + tags: + - aws AWS adoptopenjdk-12: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-adoptopenjdk-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-adoptopenjdk-12 + tags: + - aws AZURE adoptopenjdk Windows: - stage: deployment test - script: - - molecule test -s cloud-azure-adoptopenjdk-windows - tags: - - azure + stage: deployment test + script: + - molecule test -s cloud-azure-adoptopenjdk-windows + tags: + - azure # Windows tests are preferrably run in Azure .AWS adoptopenjdk Windows: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-adoptopenjdk-windows - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-adoptopenjdk-windows + tags: + - aws AWS sapmachine-11: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-sapmachine-11 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-sapmachine-11 + tags: + - aws AWS sapmachine-12: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-sapmachine-12 - tags: - - aws + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-sapmachine-12 + tags: + - aws AWS sapmachine-13: - variables: - AWS_REGION: us-east-1 - stage: deployment test - script: - - molecule test -s cloud-aws-sapmachine-13 - tags: - - aws - -# Windows tests are preferrably run in Azure + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-sapmachine-13 + tags: + - aws + +#Windows tests are preferrably run in Azure .AWS sapmachine-windows: + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-sapmachine-windows + tags: + - aws + +AWS Alibaba Dragonwell8: + variables: + AWS_REGION: us-east-1 + stage: deployment test + script: + - molecule test -s cloud-aws-dragonwell8 + tags: + - aws + +AZURE sapmachine-windows: + stage: deployment test + script: + - molecule test -s cloud-azure-sapmachine-windows + tags: + - azure + +AWS corretto-8: variables: AWS_REGION: us-east-1 stage: deployment test script: - - molecule test -s cloud-aws-sapmachine-windows + - molecule test -s cloud-aws-corretto-8 tags: - aws -AWS Alibaba Dragonwell8: +AWS corretto-11: variables: AWS_REGION: us-east-1 stage: deployment test script: - - molecule test -s cloud-aws-dragonwell8 + - molecule test -s cloud-aws-corretto-11 tags: - aws -AZURE sapmachine-windows: - stage: deployment test - script: - - molecule test -s cloud-azure-sapmachine-windows - tags: - - azure +AZURE corretto-windows: + stage: deployment test + script: + - molecule test -s cloud-azure-windows-corretto + tags: + - azure diff --git a/.travis.yml b/.travis.yml index 95b95234..ad27bfe8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ --- +os: linux dist: bionic -sudo: required language: python python: - - "3.7" + - "3.8" services: - docker @@ -13,7 +13,7 @@ before_install: - git clone https://github.com/lean-delivery/ansible-lint-rules.git ~/ansible-lint-rules install: - - pip3 install --upgrade ansible==2.8.* docker molecule==2.22 + - pip3 install --upgrade ansible==2.9.* docker molecule==2.22 - pip3 install git+https://github.com/ansible/ansible-lint.git - ansible --version - ansible-lint --version diff --git a/README.md b/README.md index f43efa31..a33f6b47 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ This Ansible role has the following features for: - Install JRE, JDK, Server-JRE - Additional opportunity to install from s3, web, local source. +**DISCLAIMER**: usage of any version of this role implies you have accepted the +[Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html). + **SAPJVM** - Install JDK @@ -48,8 +51,11 @@ This Ansible role has the following features for: - Linux/x86_64 platform only - Additional opportunity to install from dragonwell8-fallback, web, local source, s3. -DISCLAIMER: usage of any version of this role implies you have accepted the -[Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html). +**Amazon Corretto** + +- Install JDK 8 and 11 +- Install JRE 8 (Amazon Linux 2 only) +- Additional opportunity to install from fallback, web, local source, s3. Requirements @@ -78,12 +84,12 @@ Requirements - Debian stretch: tarball - Windows: tarball - 13 - - EL 6: tarball, openjdk-fallback - - EL 7: tarball, openjdk-fallback - - EL 8: tarball, openjdk-fallback - - Ubuntu bionic: tarball, openjdk-fallback - - Debian stretch: tarball, openjdk-fallback - - Windows: tarball, openjdk-fallback + - EL 6: tarball, fallback + - EL 7: tarball, fallback + - EL 8: tarball, fallback + - Ubuntu bionic: tarball, fallback + - Debian stretch: tarball, fallback + - Windows: tarball, fallback - **Supported oracle java version**: - 7 - 8 @@ -104,11 +110,11 @@ Requirements - 13 - **Supported SapMachine version**: - 11 - - EL 7: sapmachine-fallback - - EL 8: sapmachine-fallback - - Ubuntu bionic: sapmachine-fallback - - Debian stretch: sapmachine-fallback - - Windows: chocolatey (only latest version, don't support java_minor_version variables), sapmachine-fallback + - EL 7: fallback + - EL 8: fallback + - Ubuntu bionic: fallback + - Debian stretch: fallback + - Windows: chocolatey (only latest version, don't support java_minor_version variables), fallback - 12 - EL 7: tarball - EL 8: tarball @@ -116,14 +122,17 @@ Requirements - Debian stretch: tarball - Windows: tarball - 13 - - EL 7: sapmachine-fallback - - EL 8: sapmachine-fallback - - Ubuntu bionic: sapmachine-fallback - - Debian stretch: sapmachine-fallback - - Windows: chocolatey (only latest version, don't support java_minor_version variables), sapmachine-fallback + - EL 7: fallback + - EL 8: fallback + - Ubuntu bionic: fallback + - Debian stretch: fallback + - Windows: chocolatey (only latest version, don't support java_minor_version variables), fallback - **Supported Alibaba Dragonwell version**: - 8.0.0 - 8.1.1 + - **Supported Amazon Corretto version**: + - 8 + - 11 - **Supported OS**: - Ubuntu - bionic @@ -131,14 +140,17 @@ Requirements - trusty - Debian - stretch + - buster - Amazon Linux - Amazon Linux 2 - - EL + - EL (RHEL/CentOS) - 6 - 7 - 8 - Windows - - all + - 10 + - 2016 + - 2019 ## Role Variables - `java_distribution` Java distribution type, one of: @@ -149,6 +161,7 @@ Requirements - `adoptopenjdk` - `sapmachine` - `dragonwell8` + - `corretto` **Notice**: this variable is mandatory in case of installing other distribution than 'openjdk'. @@ -158,21 +171,16 @@ Requirements - `jdk` (default) - `jre` - - `transport` Artifact source transport. Use `openjdk-fallback`(OpenJDK only), `repositories`(OpenJDK only), `sapjvm-fallback`(SAPJVM only), `adoptopenjdk-fallback`(AdoptOpenJDK only),`sapmachine-fallback`(SapMachine only), `zulu-fallback`(ZULU only), `dragonwell8-fallback`(Alibaba Dragonwell only), `local`, `web` or `s3` for more predictable result. + - `transport` Artifact source transport. Use `fallback` (OpenJDK, SAPJVM, AdoptOpenJDK, SapMachine, ZULU, Alibaba Dragonwell, Amazon Corretto distributions are supported), `repositories`(OpenJDK, AdoptOpenJDK, Amazon Corretto distributions are supported), `local`, `web` or `s3` according to your requirements. Available: - - `repositories` Installing OpenJDK java from system repositories (yum or apt, Linux only) + - `repositories` Installing java from system repositories (yum or apt, Linux only) - `web` Fetching artifact from custom web url - - `chocolatey` Windows specific package manager (Supported OpenJDK: JDK 11,12 or JRE 8) + - `chocolatey` Windows specific package manager (Supported OpenJDK: JDK 11, 12 or JRE 8, SapMachine, ZULU, AdoptOpenJDK) - `local` Local artifact stored on ansible master (can be used as cache for other transport) - `s3` Download artifact from s3 bucket (Linux clients only, for Windows please use other transports) - - `sapjvm-fallback` fetching artifact from SAP site. - - `zulu-fallback` fetching artifact from AZUL site. - - `adoptopenjdk-fallback` fetching artifact from adoptopenjdk site. - - `sapmachine-fallback` fetching artifact from SapMachine site. - - `dragonwell8-fallback` fetching artifact from GitHub. - - `openjdk-fallback` fetching artifact from jdk.java.net. - This is default value for `transport` variable + - `fallback` fetching artifacts from official sites (available for distributions: openjdk, sapjvm, zulu, adoptopenjdk, sapmachine, dragonwell8, corretto). + This is *default* value for `transport` variable **Notice** using `s3` transport requires specific packages to be installed on target host: - 'botocore' @@ -225,11 +233,18 @@ Requirements - `hotspot` (default) - `openj9` +# Configure executable paths + + - `java_setup_path` - to enable binary path setup. If `true` java binaries are added to system paths, profile is updated and alternatives are set. If set to `false` - no system settings updates will be done excepting performed by package scenarios. + default: `true` + # Configure unlimited policy + - `java_unlimited_policy_enabled` - to apply unlimited policy default: `false` - - `java_unlimited_policy_transport` Artifact source transport. Use `local`, `web` or `s3` for more predictable result. + - `java_unlimited_policy_transport` Artifact source transport. Use `fallback`, `local`, `web` or `s3` for more predictable result. + defaule: `fallback` Available: - `web` Fetching artifact from custom web url @@ -251,6 +266,7 @@ ansible-galaxy install lean_delivery.java Example Playbook ---------------- ### Installing OpenJDK 13 from openjdk-fallback (default role behaviour): + ```yaml - name: Install openjdk java hosts: all @@ -260,6 +276,7 @@ Example Playbook ``` ### Installing OpenJDK 8 from repositories: + ```yaml - name: Install openjdk java hosts: all @@ -271,6 +288,7 @@ Example Playbook ``` ### Installing OpenJDK 11 from web: + ```yaml - name: Install openjdk java hosts: all @@ -284,6 +302,7 @@ Example Playbook ``` ### Installing Oracle java 8 from local file: + ```yaml - name: Install oracle java hosts: all @@ -297,6 +316,7 @@ Example Playbook ### Installing Oracle java 8 from S3 bucket: Before install you should prepare host to use aws_s3 module https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements + ```yaml - name: Install java hosts: all @@ -312,6 +332,7 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements ``` ### Installing OpenJDK 11.0.2 on Windows host with win_chocolatey: + ```yaml - name: Install java hosts: windows @@ -324,6 +345,7 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements java_minor_version: 0.2 ``` ### Installing SAPJVM 8 from sapjvm-fallback: + ```yaml - name: Install sapjvm hosts: all @@ -331,10 +353,11 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements roles: - role: lean_delivery.java java_distribution: sapjvm - transport: sapjvm-fallback + transport: fallback java_major_version: 8 ``` ### Installing ZULU 12 from zulu-fallback: + ```yaml - name: Install zulu hosts: all @@ -342,9 +365,10 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements roles: - role: lean_delivery.java java_distribution: zulu - transport: zulu-fallback + transport: fallback ``` ### Installing AdoptOpenJDK 8-openj9-jre from adoptopenjdk-fallback: + ```yaml - name: Install AdoptOpenJDK hosts: all @@ -352,13 +376,14 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements roles: - role: lean_delivery.java java_distribution: adoptopenjdk - transport: adoptopenjdk-fallback + transport: fallback java_package: jre adoptopenjdk_impl: openj9 java_major_version: 8 ``` ### Installing SapMachine sapmachine-jre-10 from sapmachine-fallback: + ```yaml - name: Install SapMachine hosts: all @@ -366,11 +391,12 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements roles: - role: lean_delivery.java java_distribution: sapmachine - transport: sapmachine-fallback + transport: fallback java_package: jre java_major_version: 10 ``` ### Installing Alibaba Dragonwell 8 from dragonwell8-fallback: + ```yaml - name: Install Alibaba Dragonwell8 hosts: all @@ -378,9 +404,48 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements roles: - role: lean_delivery.java java_distribution: dragonwell8 - transport: dragonwell8-fallback + transport: fallback + java_major_version: 8 +``` +### Installing Amazon Corretto JDK 8 from corretto-fallback: + +```yaml +- name: Install Amazon Corretto + hosts: all + + roles: + - role: lean_delivery.java + java_distribution: corretto + transport: fallback java_major_version: 8 ``` + +### Installing Amazon Corretto JDK 11 from repo on Amazon Linux 2: + +```yaml +- name: Install Amazon Corretto + hosts: all + + roles: + - role: lean_delivery.java + java_distribution: corretto + transport: repositories + java_major_version: 11 +``` + +### Installing Amazon Corretto JDK 11 on Ubuntu 18.04 from web: + +```yaml +- name: Install Amazon Corretto + hosts: all + + roles: + - role: lean_delivery.java + java_distribution: corretto + transport: web + transport_web: https://d3pxv6yz143wms.cloudfront.net/11.0.5.10.1/amazon-corretto-11.0.5.10.1-linux-x64.tar.gz +``` + License ------- diff --git a/defaults/main.yml b/defaults/main.yml index 6d148020..98567aba 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,6 +7,7 @@ # - adoptopenjdk (not supported 9/10) # - alibaba_dragonwell (8 only) # - sapmachine +# - Amazon Corretto (supported only 8/11) java_distribution: openjdk # OpenJDK tarball supported only jdk @@ -14,6 +15,8 @@ java_distribution: openjdk # AdoptOpenJDK supported jdk/jre # SapMachine supported jdk/jre # Alibaba Dragonwell supported jdk only +# Amazon Corretto 8 supported jdk/jre, jre only for Windows and Amazon Linux2 +# Amazon Corretto 11 supported only jdk java_package: jdk # AdoptOpenJDK Implementation (hotspot/openj9) @@ -37,9 +40,11 @@ java_path: "{{ (transport == 'repositories') | ternary('/usr/lib/jvm', java_defa java_download_path: '{{ java_download_default_path }}' # Custom artifact source transport -java_tarball_install: "{{ transport != 'repositories' }}" -java_binary_type: "{{ java_tarball_install | ternary('tarball', 'package') }}" -transport: openjdk-fallback +java_tarball_install: >- + {{ transport != 'repositories' }} +java_binary_type: >- + {{ java_tarball_install | ternary('tarball', 'package') }} +transport: fallback # available are: # - "web" Fetching artifact from custom web uri (not supporting idempotent operation) # - "s3" Fetching artifact from s3 bucket @@ -52,6 +57,7 @@ transport: openjdk-fallback # - "zulu-fallback" Install from artifact downloaded from AZUL site # - "sapmachine-fallback" Install from artifact downloaded from SapMachine site # - "dragonwell-fallback" Install from artifact downloaded from GitHub site +# - "corretto-fallback" Install from artifact downloaded from AWS Amazon site transport_web: '{{ transport_web_default }}' transport_local: "/tmp/openjdk-11.0.2_linux-x64_bin.tar.gz" @@ -61,6 +67,8 @@ transport_s3_path: /folder/jdk-8u172-linux-x64.tar.gz transport_s3_aws_access_key: "{{ lookup('env','AWS_ACCESS_KEY') }}" transport_s3_aws_secret_key: "{{ lookup('env','AWS_SECRET_KEY') }}" +java_setup_path: true + # Configure unlimited security policy java_unlimited_policy_enabled: false # For Java earlier than 1.8.0_151 diff --git a/library/win_chocolatey_feature.ps1 b/library/win_chocolatey_feature.ps1 deleted file mode 100644 index c71209aa..00000000 --- a/library/win_chocolatey_feature.ps1 +++ /dev/null @@ -1,74 +0,0 @@ -#!powershell - -# Copyright: (c), 2018 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -#Requires -Module Ansible.ModuleUtils.CommandUtil -#Requires -Module Ansible.ModuleUtils.Legacy - -$ErrorActionPreference = "Stop" - -$params = Parse-Args -arguments $args -supports_check_mode $true -$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false - -$name = Get-AnsibleParam -obj $params -name "name" -type "str" -failifempty $true -$state = Get-AnsibleParam -obj $params -name "state" -type "str" -default "enabled" -validateset "disabled", "enabled" - -$result = @{ - changed = $false -} - -Function Get-ChocolateyFeatures { - param($choco_app) - - $res = Run-Command -command "`"$($choco_app.Path)`" feature list -r" - if ($res.rc -ne 0) { - Fail-Json -obj $result -message "Failed to list Chocolatey features: $($res.stderr)" - } - $feature_info = @{} - $res.stdout -split "`r`n" | Where-Object { $_ -ne "" } | ForEach-Object { - $feature_split = $_ -split "\|" - $feature_info."$($feature_split[0])" = $feature_split[1] -eq "Enabled" - } - - return ,$feature_info -} - -Function Set-ChocolateyFeature { - param( - $choco_app, - $name, - $enabled - ) - - if ($enabled) { - $state_string = "enable" - } else { - $state_string = "disable" - } - $res = Run-Command -command "`"$($choco_app.Path)`" feature $state_string --name `"$name`"" - if ($res.rc -ne 0) { - Fail-Json -obj $result -message "Failed to set Chocolatey feature $name to $($state_string): $($res.stderr)" - } -} - -$choco_app = Get-Command -Name choco.exe -CommandType Application -ErrorAction SilentlyContinue -if (-not $choco_app) { - Fail-Json -obj $result -message "Failed to find Chocolatey installation, make sure choco.exe is in the PATH env value" -} - -$feature_info = Get-ChocolateyFeatures -choco_app $choco_app -if ($name -notin $feature_info.keys) { - Fail-Json -obj $result -message "Invalid feature name '$name' specified, valid features are: $($feature_info.keys -join ', ')" -} - -$expected_status = $state -eq "enabled" -$feature_status = $feature_info.$name -if ($feature_status -ne $expected_status) { - if (-not $check_mode) { - Set-ChocolateyFeature -choco_app $choco_app -name $name -enabled $expected_status - } - $result.changed = $true -} - -Exit-Json -obj $result \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml index 36b740b7..db81abb4 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: "Lean Delivery Java install" company: "Epam Systems" license: "Apache" - min_ansible_version: "2.7" + min_ansible_version: "2.8" issue_tracker_url: "https://github.com/lean-delivery/ansible-role-java/issues" platforms: - name: "Ubuntu" @@ -15,6 +15,7 @@ galaxy_info: - name: "Debian" versions: - "stretch" + - "buster" - name: "EL" versions: - "6" diff --git a/molecule/cloud-aws-adoptopenjdk-11/molecule.yml b/molecule/cloud-aws-adoptopenjdk-11/molecule.yml index 04d7ad06..d507c96e 100644 --- a/molecule/cloud-aws-adoptopenjdk-11/molecule.yml +++ b/molecule/cloud-aws-adoptopenjdk-11/molecule.yml @@ -108,6 +108,7 @@ provisioner: log: false config_options: defaults: + forks: 30 callback_whitelist: profile_tasks,timer inventory: group_vars: @@ -123,7 +124,7 @@ provisioner: hotspot: adoptopenjdk_impl: hotspot adoptopenjdk_fallback: - transport: adoptopenjdk-fallback + transport: fallback repositories: transport: repositories local: diff --git a/molecule/cloud-aws-adoptopenjdk-11/prepare.yml b/molecule/cloud-aws-adoptopenjdk-11/prepare.yml index 7d9c35c3..126e9704 100644 --- a/molecule/cloud-aws-adoptopenjdk-11/prepare.yml +++ b/molecule/cloud-aws-adoptopenjdk-11/prepare.yml @@ -1,7 +1,4 @@ --- -- name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml - - name: Prepare Debian hosts: debian_family tasks: @@ -15,8 +12,9 @@ - name: Install python packages apt: - name: - - python-setuptools + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} state: present register: status until: status is succeeded @@ -32,6 +30,20 @@ {{ ansible_distribution_major_version }}.noarch.rpm" state: 'present' register: status + retries: 10 + delay: 5 + until: status is succeeded + become: true + + - name: Add python-dnf + yum: + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-dnf', 'python-dnf') }} + state: 'present' + register: status + retries: 10 + delay: 5 until: status is succeeded become: true diff --git a/molecule/cloud-aws-adoptopenjdk-12/molecule.yml b/molecule/cloud-aws-adoptopenjdk-12/molecule.yml index 0884fb12..62c4c69e 100644 --- a/molecule/cloud-aws-adoptopenjdk-12/molecule.yml +++ b/molecule/cloud-aws-adoptopenjdk-12/molecule.yml @@ -134,6 +134,7 @@ provisioner: log: false config_options: defaults: + forks: 30 callback_whitelist: profile_tasks,timer inventory: group_vars: @@ -143,7 +144,6 @@ provisioner: pip3: pip_executable: pip3 python_executable: python3 - ansible_python_interpreter: /usr/bin/python3 adoptopenjdk: java_distribution: adoptopenjdk java_major_version: 12 @@ -156,7 +156,7 @@ provisioner: hotspot: adoptopenjdk_impl: hotspot adoptopenjdk_fallback: - transport: adoptopenjdk-fallback + transport: fallback repositories: transport: repositories s3: diff --git a/molecule/cloud-aws-adoptopenjdk-12/prepare.yml b/molecule/cloud-aws-adoptopenjdk-12/prepare.yml index b678b91c..d0fd658a 100644 --- a/molecule/cloud-aws-adoptopenjdk-12/prepare.yml +++ b/molecule/cloud-aws-adoptopenjdk-12/prepare.yml @@ -1,7 +1,4 @@ --- -- name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml - - name: Prepare Debian hosts: debian_family tasks: @@ -15,8 +12,9 @@ - name: Install python packages apt: - name: - - python-setuptools + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} state: present register: status until: status is succeeded @@ -32,6 +30,20 @@ {{ ansible_distribution_major_version }}.noarch.rpm" state: 'present' register: status + retries: 10 + delay: 5 + until: status is succeeded + become: true + + - name: Add python-dnf + yum: + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-dnf', 'python-dnf') }} + state: 'present' + register: status + retries: 10 + delay: 5 until: status is succeeded become: true @@ -39,11 +51,14 @@ hosts: s3 tasks: - - name: Install pip package + - name: Install python packages package: - name: '{{ python_executable }}-pip' + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-pip', 'python-pip') }} state: present register: status + retries: 10 until: status is succeeded become: true @@ -54,8 +69,11 @@ - boto - boto3 state: present - executable: '{{ pip_executable }}' + executable: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('pip3', 'pip') }} extra_args: --upgrade register: status + retries: 10 until: status is succeeded become: true diff --git a/molecule/cloud-aws-adoptopenjdk-8/molecule.yml b/molecule/cloud-aws-adoptopenjdk-8/molecule.yml index 1f018e37..b19aac30 100644 --- a/molecule/cloud-aws-adoptopenjdk-8/molecule.yml +++ b/molecule/cloud-aws-adoptopenjdk-8/molecule.yml @@ -108,6 +108,7 @@ provisioner: log: false config_options: defaults: + forks: 30 callback_whitelist: profile_tasks,timer inventory: group_vars: @@ -123,7 +124,7 @@ provisioner: hotspot: adoptopenjdk_impl: hotspot adoptopenjdk_fallback: - transport: adoptopenjdk-fallback + transport: fallback repositories: transport: repositories web: @@ -132,7 +133,7 @@ provisioner: https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u212-b04/OpenJDK8U-jdk_x64_linux_hotspot_8u212b04.tar.gz playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml + prepare: ../resources/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-adoptopenjdk-windows/molecule.yml b/molecule/cloud-aws-adoptopenjdk-windows/molecule.yml index 6b753aa3..14f379ff 100644 --- a/molecule/cloud-aws-adoptopenjdk-windows/molecule.yml +++ b/molecule/cloud-aws-adoptopenjdk-windows/molecule.yml @@ -95,7 +95,7 @@ provisioner: hotspot: adoptopenjdk_impl: hotspot adoptopenjdk_fallback: - transport: adoptopenjdk-fallback + transport: fallback chocolatey: transport: chocolatey windows: diff --git a/molecule/cloud-aws-coretto-11/molecule.yml b/molecule/cloud-aws-coretto-11/molecule.yml new file mode 100644 index 00000000..c4ff33f2 --- /dev/null +++ b/molecule/cloud-aws-coretto-11/molecule.yml @@ -0,0 +1,211 @@ +--- +dependency: + name: galaxy + options: + role-file: requirements.yml +driver: + name: ec2 +lint: + name: yamllint + options: + config-file: .yamllint +platforms: + - name: test-aws-centos7-corretto-jdk-fallback-11 + image: ami-9887c6e7 + platform: centos7 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - fallback + + - name: test-aws-centos8-corretto-jdk-fallback-11 + image: ami-0ed2ad9dc845b42b6 + platform: centos8 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - fallback + - centos8 + + - name: test-aws-Debian9-corretto-jdk-fallback-11-tb + image: ami-003f19e0e687de1cd + platform: debian9 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: admin + groups: + - debian_family + - corretto + - fallback + - tarball + + - name: test-aws-ubuntu18-corretto-jdk-fallback-11 + image: ami-012fd5eb46f56731f + platform: ubuntu18 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ubuntu + groups: + - debian_family + - corretto + - fallback + - package + + - name: test-aws-centos7-corretto-web-11 + image: ami-9887c6e7 + platform: centos7 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - web + + - name: test-aws-centos8-corretto-jdk-web-11 + image: ami-0ed2ad9dc845b42b6 + platform: centos8 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - web + - centos8 + + - name: test-aws-Debian9-corretto-jdk-web-11 + image: ami-003f19e0e687de1cd + platform: debian9 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: admin + groups: + - debian_family + - corretto + - web + + - name: test-aws-ubuntu18-corretto-jdk-web-11 + image: ami-012fd5eb46f56731f + platform: ubuntu18 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ubuntu + groups: + - debian_family + - corretto + - web + + - name: test-aws-Amazon2-corretto-11 + image: ami-0b898040803850657 + platform: amazon2 + instance_type: t3.micro + profile_name: epmldi-instance-profile + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ec2-user + groups: + - rhel_family + - corretto + - repositories + +provisioner: + name: ansible + log: false + config_options: + defaults: + callback_whitelist: profile_tasks,timer + inventory: + group_vars: + corretto: + java_distribution: corretto + java_major_version: 11 + jdk: + java_package: jdk + jre: + java_package: jre + fallback: + transport: fallback + package: + java_tarball_install: false + tarball: + java_tarball_install: true + web: + java_tarball_install: true + transport: web + transport_web: >- + https://d3pxv6yz143wms.cloudfront.net/11.0.5.10.1/amazon-corretto-11.0.5.10.1-linux-x64.tar.gz + repositories: + transport: repositories + playbooks: + create: ../resources/provisioning/AWS/create.yml + prepare: ../resources/prepare.yml + destroy: ../resources/provisioning/AWS/destroy.yml + verify: ../resources/tests/verify.yml + lint: + name: ansible-lint +scenario: + name: cloud-aws-corretto-11 +verifier: + name: ansible + lint: + name: ansible-lint diff --git a/molecule/cloud-aws-coretto-11/playbook.yml b/molecule/cloud-aws-coretto-11/playbook.yml new file mode 100644 index 00000000..2bd7212e --- /dev/null +++ b/molecule/cloud-aws-coretto-11/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: ansible-role-java diff --git a/molecule/cloud-aws-corretto-8/molecule.yml b/molecule/cloud-aws-corretto-8/molecule.yml new file mode 100644 index 00000000..bf4c898c --- /dev/null +++ b/molecule/cloud-aws-corretto-8/molecule.yml @@ -0,0 +1,234 @@ +--- +dependency: + name: galaxy + options: + role-file: requirements.yml +driver: + name: ec2 +lint: + name: yamllint + options: + config-file: .yamllint +platforms: + - name: test-aws-centos7-corretto-jdk-fallback-8-tb + image: ami-02eac2c0129f6376b + platform: centos7 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.04 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - fallback + - tarball + + - name: test-aws-centos8-corretto-jdk-fallback-8 + image: ami-0ed2ad9dc845b42b6 + platform: centos8 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.04 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - fallback + - centos8 + - package + + - name: test-aws-Debian9-corretto-jdk-fallback-8 + image: ami-003f19e0e687de1cd + platform: debian9 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.04 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: admin + groups: + - debian_family + - corretto + - fallback + - package + + - name: test-aws-ubuntu18-corretto-jdk-fallback-8 + image: ami-07ebfd5b3428b6f4d + platform: ubuntu18 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.04 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ubuntu + groups: + - debian_family + - corretto + - fallback + - package + + - name: test-aws-centos7-corretto-web-8 + image: ami-9887c6e7 + platform: centos7 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - web + + - name: test-aws-centos8-corretto-jdk-web-8 + image: ami-0ed2ad9dc845b42b6 + platform: centos8 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: centos + groups: + - rhel_family + - corretto + - web + - centos8 + + - name: test-aws-Debian9-corretto-jdk-web-8 + image: ami-003f19e0e687de1cd + platform: debian9 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: admin + groups: + - debian_family + - corretto + - web + + - name: test-aws-ubuntu18-corretto-jdk-web-8 + image: ami-012fd5eb46f56731f + platform: ubuntu18 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ubuntu + groups: + - debian_family + - corretto + - web + + - name: test-aws-Amazon2-corretto-jdk-8 + image: ami-0b898040803850657 + platform: amazon2 + instance_type: t3.micro + profile_name: epmldi-instance-profile + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ec2-user + groups: + - rhel_family + - corretto + - jdk + - repositories + + - name: test-aws-Amazon2-corretto-jre-8 + image: ami-0b898040803850657 + platform: amazon2 + instance_type: t3.micro + profile_name: epmldi-instance-profile + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.004 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: ec2-user + groups: + - rhel_family + - corretto + - jre + - repositories + +provisioner: + name: ansible + log: false + config_options: + defaults: + forks: 30 + callback_whitelist: profile_tasks,timer + inventory: + group_vars: + corretto: + java_distribution: corretto + java_major_version: 8 + jdk: + java_package: jdk + jre: + java_package: jre + repositories: + transport: repositories + fallback: + transport: fallback + package: + java_tarball_install: false + tarball: + java_tarball_install: true + web: + transport: web + java_tarball_install: true + transport_web: >- + https://d3pxv6yz143wms.cloudfront.net/8.232.09.1/amazon-corretto-8.232.09.1-linux-x64.tar.gz + playbooks: + create: ../resources/provisioning/AWS/create.yml + prepare: ../resources/prepare.yml + destroy: ../resources/provisioning/AWS/destroy.yml + verify: ../resources/tests/verify.yml + lint: + name: ansible-lint +scenario: + name: cloud-aws-corretto-8 +verifier: + name: ansible + lint: + name: ansible-lint diff --git a/molecule/cloud-aws-corretto-8/playbook.yml b/molecule/cloud-aws-corretto-8/playbook.yml new file mode 100644 index 00000000..2bd7212e --- /dev/null +++ b/molecule/cloud-aws-corretto-8/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: ansible-role-java diff --git a/molecule/cloud-aws-direct-11/prepare.yml b/molecule/cloud-aws-direct-11/prepare.yml index b1f4db76..ee2e2e9b 100644 --- a/molecule/cloud-aws-direct-11/prepare.yml +++ b/molecule/cloud-aws-direct-11/prepare.yml @@ -1,31 +1,30 @@ --- -- name: Prepare Ubuntu / Debian +- name: Prepare Debian hosts: debian_family - gather_facts: false tasks: - - name: Install python for Ansible - raw: test -e /usr/bin/python || (apt install -y python-minimal) + - name: Add universe repository for bionic + apt_repository: + repo: deb http://archive.ubuntu.com/ubuntu bionic universe + state: present + when: ansible_distribution_release == 'bionic' + become: true + + - name: Install python packages + apt: + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} + state: present + register: status + until: status is succeeded become: true - changed_when: false - register: update_result - retries: 10 - delay: 5 - until: update_result.rc == 0 - name: Prepare RHEL hosts: rhel_family - gather_facts: false tasks: - - name: Install python for Ansible - raw: test -e /usr/bin/python || (yum install -y python2 python-simplejson) - become: true - changed_when: false - - - name: gather facts - setup: - - name: 'Enable EPEL repository' + - name: Enable EPEL repository yum: name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-\ {{ ansible_distribution_major_version }}.noarch.rpm" @@ -38,22 +37,26 @@ hosts: s3 gather_facts: true tasks: - - name: 'Install pip package' + - name: Install pip package package: - name: python-pip + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-pip', 'python-pip') }} state: present register: status until: status is succeeded become: true - - name: 'Install boto module' + - name: Install boto module pip: name: - - 'pip' - - 'botocore' - - 'boto' - - 'boto3' + - botocore + - boto + - boto3 state: present + executable: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('pip3', 'pip') }} extra_args: --upgrade register: status until: status is succeeded diff --git a/molecule/cloud-aws-direct-12/molecule.yml b/molecule/cloud-aws-direct-12/molecule.yml index 6b3cef98..d66215bd 100644 --- a/molecule/cloud-aws-direct-12/molecule.yml +++ b/molecule/cloud-aws-direct-12/molecule.yml @@ -142,7 +142,6 @@ provisioner: pip3: pip_executable: pip3 python_executable: python3 - ansible_python_interpreter: /usr/bin/python3 centos: epel_path: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-\ {{ ansible_distribution_major_version }}.noarch.rpm" diff --git a/molecule/cloud-aws-direct-12/prepare.yml b/molecule/cloud-aws-direct-12/prepare.yml index 403e160a..f4a3c61c 100644 --- a/molecule/cloud-aws-direct-12/prepare.yml +++ b/molecule/cloud-aws-direct-12/prepare.yml @@ -1,7 +1,4 @@ --- -- name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml - - name: Prepare Debian hosts: debian_family tasks: @@ -15,8 +12,9 @@ - name: Install python packages apt: - name: - - python-setuptools + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} state: present register: status until: status is succeeded @@ -32,6 +30,7 @@ name: '{{ epel_path }}' state: present register: status + retries: 10 until: status is succeeded become: true @@ -40,9 +39,12 @@ tasks: - name: Install pip package package: - name: '{{ python_executable }}-pip' + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-pip', 'python-pip') }} state: present register: status + retries: 10 until: status is succeeded become: true @@ -53,7 +55,9 @@ - boto - boto3 state: present - executable: '{{ pip_executable }}' + executable: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('pip3', 'pip') }} extra_args: --upgrade register: status until: status is succeeded diff --git a/molecule/cloud-aws-direct-6/molecule.yml b/molecule/cloud-aws-direct-6/molecule.yml index 5dae17a7..82cbca15 100644 --- a/molecule/cloud-aws-direct-6/molecule.yml +++ b/molecule/cloud-aws-direct-6/molecule.yml @@ -59,7 +59,7 @@ provisioner: transport: web transport_web: "{{ lookup('env','STORAGE_AWS') }}/oracle-java/jdk-6u45-linux-x64.tar.gz" java_unlimited_policy_enabled: true - java_unlimited_policy_transport: oracle-fallback + java_unlimited_policy_transport: fallback rpm: java_distribution: oracle_java @@ -69,10 +69,9 @@ provisioner: transport: web transport_web: "{{ lookup('env','STORAGE_AWS') }}/oracle-java/jdk-6u45-linux-x64.rpm" java_unlimited_policy_enabled: true - java_unlimited_policy_transport: oracle-fallback + java_unlimited_policy_transport: fallback playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-direct-7/molecule.yml b/molecule/cloud-aws-direct-7/molecule.yml index 0ac501c2..7fac077c 100644 --- a/molecule/cloud-aws-direct-7/molecule.yml +++ b/molecule/cloud-aws-direct-7/molecule.yml @@ -71,7 +71,6 @@ provisioner: java_unlimited_policy_transport: oracle-fallback playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-direct-8/molecule.yml b/molecule/cloud-aws-direct-8/molecule.yml index b65ddec1..6448f2c7 100644 --- a/molecule/cloud-aws-direct-8/molecule.yml +++ b/molecule/cloud-aws-direct-8/molecule.yml @@ -100,7 +100,6 @@ provisioner: pip3: pip_executable: pip3 python_executable: python3 - ansible_python_interpreter: /usr/bin/python3 local: transport: local transport_local: /tmp/jdk-8u202-linux-x64.tar.gz @@ -121,7 +120,7 @@ provisioner: transport_s3_path: /java/jdk-8u202-linux-x64.rpm playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../cloud-aws-direct-8/prepare.yml + prepare: prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-direct-8/prepare.yml b/molecule/cloud-aws-direct-8/prepare.yml index 2ba62464..0603da4a 100644 --- a/molecule/cloud-aws-direct-8/prepare.yml +++ b/molecule/cloud-aws-direct-8/prepare.yml @@ -1,7 +1,4 @@ --- -- name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml - - name: Prepare Debian hosts: debian_family tasks: @@ -15,8 +12,9 @@ - name: Install python packages apt: - name: - - python-setuptools + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} state: present register: status until: status is succeeded @@ -28,9 +26,9 @@ - name: Enable EPEL repository yum: - name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-\ - {{ ansible_distribution_major_version }}.noarch.rpm" - state: 'present' + name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest\ + -{{ ansible_distribution_major_version }}.noarch.rpm" + state: present register: status until: status is succeeded become: true @@ -40,9 +38,12 @@ tasks: - name: Install pip package package: - name: '{{ python_executable }}-pip' + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-pip', 'python-pip') }} state: present register: status + retries: 10 until: status is succeeded become: true @@ -53,7 +54,9 @@ - boto - boto3 state: present - executable: '{{ pip_executable }}' + executable: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('pip3', 'pip') }} extra_args: --upgrade register: status until: status is succeeded diff --git a/molecule/cloud-aws-dragonwell8/molecule.yml b/molecule/cloud-aws-dragonwell8/molecule.yml index 92785906..3673475e 100644 --- a/molecule/cloud-aws-dragonwell8/molecule.yml +++ b/molecule/cloud-aws-dragonwell8/molecule.yml @@ -25,6 +25,7 @@ platforms: groups: - rhel_family - dragonwell8 + - centos8 - name: test-aws-centos7-dragonwell8 image: ami-9887c6e7 @@ -84,11 +85,11 @@ provisioner: group_vars: dragonwell8: java_distribution: dragonwell8 - transport: dragonwell8-fallback + transport: fallback java_major_version: 8 playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml + prepare: ../resources/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-openjdk-11/molecule.yml b/molecule/cloud-aws-openjdk-11/molecule.yml index 0b2615fa..b0c24f6f 100644 --- a/molecule/cloud-aws-openjdk-11/molecule.yml +++ b/molecule/cloud-aws-openjdk-11/molecule.yml @@ -80,7 +80,7 @@ provisioner: java_tarball_install: false playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml + prepare: ../resources/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-openjdk-8/molecule.yml b/molecule/cloud-aws-openjdk-8/molecule.yml index 6a423821..6c45dd36 100644 --- a/molecule/cloud-aws-openjdk-8/molecule.yml +++ b/molecule/cloud-aws-openjdk-8/molecule.yml @@ -25,6 +25,7 @@ platforms: groups: - rhel_family - repositories + - centos8 - name: test-aws-centos7-openjdk-8-repo image: ami-9887c6e7 @@ -105,7 +106,7 @@ provisioner: java_tarball_install: false playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml + prepare: ../resources/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-openjdk-ga/molecule.yml b/molecule/cloud-aws-openjdk-ga/molecule.yml index 3f0d2742..8c89a88c 100644 --- a/molecule/cloud-aws-openjdk-ga/molecule.yml +++ b/molecule/cloud-aws-openjdk-ga/molecule.yml @@ -24,6 +24,7 @@ platforms: ssh_user: centos groups: - rhel_family + - centos8 - name: test-aws-centos7-openjdk-ga image: ami-9887c6e7 @@ -40,21 +41,6 @@ platforms: groups: - rhel_family - - name: test-aws-centos6-openjdk-ga - image: ami-1585c46a - platform: centos6 - instance_type: t2.medium - region: us-east-1 - vpc_subnet_id: subnet-0f2b9cd66faea38af - assign_public_ip: false - spot_price: 0.05 - security_group_name: - - default - wait_timeout: 1800 - ssh_user: centos - groups: - - rhel_family - - name: test-aws-ubuntu18-openjdk-ga image: ami-012fd5eb46f56731f platform: ubuntu18 @@ -85,6 +71,21 @@ platforms: groups: - debian_family + - name: test-aws-Debian10-openjdk-ga + image: ami-0dedf6a6502877301 + platform: debian10 + instance_type: t3.micro + region: us-east-1 + vpc_subnet_id: subnet-0f2b9cd66faea38af + assign_public_ip: false + spot_price: 0.05 + security_group_name: + - default + wait_timeout: 1800 + ssh_user: admin + groups: + - debian_family + - name: test-aws-Amazon-openjdk-ga image: ami-035b3c7efe6d061d5 platform: amazon @@ -120,10 +121,11 @@ provisioner: log: false config_options: defaults: + forks: 30 callback_whitelist: profile_tasks,timer playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml + prepare: ../resources/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-sapjvm-8/molecule.yml b/molecule/cloud-aws-sapjvm-8/molecule.yml index d3335c15..c11e605a 100644 --- a/molecule/cloud-aws-sapjvm-8/molecule.yml +++ b/molecule/cloud-aws-sapjvm-8/molecule.yml @@ -26,7 +26,7 @@ platforms: groups: - rhel_family - sapjvm - - rhel8 + - centos8 - name: test-aws-centos7-sapjvm-8 image: ami-9887c6e7 @@ -86,7 +86,7 @@ provisioner: group_vars: sapjvm: java_distribution: sapjvm - transport: sapjvm-fallback + transport: fallback java_major_version: 8 playbooks: create: ../resources/provisioning/AWS/create.yml diff --git a/molecule/cloud-aws-sapjvm-8/prepare.yml b/molecule/cloud-aws-sapjvm-8/prepare.yml index ac0fd923..6b41265a 100644 --- a/molecule/cloud-aws-sapjvm-8/prepare.yml +++ b/molecule/cloud-aws-sapjvm-8/prepare.yml @@ -1,9 +1,9 @@ --- - name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml + import_playbook: ../resources/prepare.yml - name: Prepare RHEL - hosts: rhel8 + hosts: centos8 tasks: - name: Install libnsl diff --git a/molecule/cloud-aws-sapmachine-11/molecule.yml b/molecule/cloud-aws-sapmachine-11/molecule.yml index 91b64847..a503f7ed 100644 --- a/molecule/cloud-aws-sapmachine-11/molecule.yml +++ b/molecule/cloud-aws-sapmachine-11/molecule.yml @@ -48,6 +48,7 @@ platforms: - jre - sapmachine_fallback - pip3 + - centos8 - name: test-aws-Debian9-sapmachine-jre-tarball-11 image: ami-003f19e0e687de1cd @@ -123,7 +124,7 @@ provisioner: jre: java_package: jre sapmachine_fallback: - transport: sapmachine-fallback + transport: fallback web: transport: web transport_web: >- @@ -134,10 +135,9 @@ provisioner: pip3: pip_executable: pip3 python_executable: python3 - ansible_python_interpreter: /usr/bin/python3 playbooks: create: ../resources/provisioning/AWS/create.yml - prepare: ../resources/provisioning/AWS/prepare.yml + prepare: ../resources/prepare.yml destroy: ../resources/provisioning/AWS/destroy.yml verify: ../resources/tests/verify.yml lint: diff --git a/molecule/cloud-aws-sapmachine-12/molecule.yml b/molecule/cloud-aws-sapmachine-12/molecule.yml index bdb2e5e0..d1c3a1d2 100644 --- a/molecule/cloud-aws-sapmachine-12/molecule.yml +++ b/molecule/cloud-aws-sapmachine-12/molecule.yml @@ -120,7 +120,7 @@ provisioner: jre: java_package: jre sapmachine_fallback: - transport: sapmachine-fallback + transport: fallback local: transport: local transport_local: /tmp/sapmachine-jdk-12.0.2_linux-x64_bin.tar.gz @@ -130,7 +130,6 @@ provisioner: pip3: pip_executable: pip3 python_executable: python3 - ansible_python_interpreter: /usr/bin/python3 playbooks: create: ../resources/provisioning/AWS/create.yml prepare: ../cloud-aws-sapmachine-12/prepare.yml diff --git a/molecule/cloud-aws-sapmachine-12/prepare.yml b/molecule/cloud-aws-sapmachine-12/prepare.yml index a0aa27af..9b29b6f1 100644 --- a/molecule/cloud-aws-sapmachine-12/prepare.yml +++ b/molecule/cloud-aws-sapmachine-12/prepare.yml @@ -1,7 +1,4 @@ --- -- name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml - - name: Prepare Debian hosts: debian_family tasks: @@ -14,8 +11,9 @@ - name: Install python packages apt: - name: - - python-setuptools + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} state: present register: status until: status is succeeded @@ -30,6 +28,8 @@ {{ ansible_distribution_major_version }}.noarch.rpm" state: 'present' register: status + retries: 10 + delay: 5 until: status is succeeded become: true diff --git a/molecule/cloud-aws-sapmachine-13/molecule.yml b/molecule/cloud-aws-sapmachine-13/molecule.yml index f0406deb..921795ee 100644 --- a/molecule/cloud-aws-sapmachine-13/molecule.yml +++ b/molecule/cloud-aws-sapmachine-13/molecule.yml @@ -121,7 +121,7 @@ provisioner: jre: java_package: jre sapmachine_fallback: - transport: sapmachine-fallback + transport: fallback s3: transport: s3 transport_s3_bucket: java-molecule-s3-test @@ -134,7 +134,6 @@ provisioner: pip3: pip_executable: pip3 python_executable: python3 - ansible_python_interpreter: /usr/bin/python3 playbooks: create: ../resources/provisioning/AWS/create.yml prepare: ../cloud-aws-sapmachine-13/prepare.yml diff --git a/molecule/cloud-aws-sapmachine-13/prepare.yml b/molecule/cloud-aws-sapmachine-13/prepare.yml index 72b2fbd7..2a18b915 100644 --- a/molecule/cloud-aws-sapmachine-13/prepare.yml +++ b/molecule/cloud-aws-sapmachine-13/prepare.yml @@ -1,10 +1,8 @@ --- -- name: Include common prepare - import_playbook: ../resources/provisioning/AWS/prepare.yml - - name: Prepare Debian hosts: debian_family tasks: + - name: Add universe repository for bionic apt_repository: repo: deb http://archive.ubuntu.com/ubuntu bionic universe @@ -14,8 +12,9 @@ - name: Install python packages apt: - name: - - python-setuptools + name: >- + {{ (ansible_facts.python.version.major|int == 3 ) + | ternary('python3-setuptools', 'python-setuptools') }} state: present register: status until: status is succeeded @@ -24,12 +23,15 @@ - name: Prepare RHEL hosts: rhel_family tasks: + - name: Enable EPEL repository yum: name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-\ {{ ansible_distribution_major_version }}.noarch.rpm" state: 'present' register: status + retries: 10 + delay: 5 until: status is succeeded become: true @@ -49,7 +51,9 @@ tasks: - name: Install pip package package: - name: '{{ python_executable }}-pip' + name: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('python3-pip', 'python-pip') }} state: present register: status until: status is succeeded @@ -62,7 +66,9 @@ - boto - boto3 state: present - executable: '{{ pip_executable }}' + executable: >- + {{ (ansible_facts.python.version.major|int ==3 ) + | ternary('pip3', 'pip') }} extra_args: --upgrade register: status until: status is succeeded diff --git a/molecule/cloud-aws-sapmachine-windows/molecule.yml b/molecule/cloud-aws-sapmachine-windows/molecule.yml index 2ae133be..2c02fc24 100644 --- a/molecule/cloud-aws-sapmachine-windows/molecule.yml +++ b/molecule/cloud-aws-sapmachine-windows/molecule.yml @@ -73,7 +73,7 @@ provisioner: ver13: java_major_version: 13 sapmachine_fallback: - transport: sapmachine-fallback + transport: fallback chocolatey: transport: chocolatey windows: diff --git a/molecule/cloud-aws-windows-sapjvm-8/molecule.yml b/molecule/cloud-aws-windows-sapjvm-8/molecule.yml index 96c3b852..d4f86de2 100644 --- a/molecule/cloud-aws-windows-sapjvm-8/molecule.yml +++ b/molecule/cloud-aws-windows-sapjvm-8/molecule.yml @@ -53,7 +53,7 @@ provisioner: ansible_winrm_server_cert_validation: ignore sapjvm: java_distribution: sapjvm - transport: sapjvm-fallback + transport: fallback java_major_version: 8 playbooks: create: ../resources/provisioning/AWS/create.yml diff --git a/molecule/cloud-aws-windows-zulu-12/molecule.yml b/molecule/cloud-aws-windows-zulu-12/molecule.yml index b7440b62..139b1737 100644 --- a/molecule/cloud-aws-windows-zulu-12/molecule.yml +++ b/molecule/cloud-aws-windows-zulu-12/molecule.yml @@ -53,7 +53,7 @@ provisioner: ansible_winrm_server_cert_validation: ignore zulu: java_distribution: zulu - transport: zulu-fallback + transport: fallback playbooks: create: ../resources/provisioning/AWS/create.yml destroy: ../resources/provisioning/AWS/destroy.yml diff --git a/molecule/cloud-aws-zulu-12/molecule.yml b/molecule/cloud-aws-zulu-12/molecule.yml index 200ee322..73b65bfc 100644 --- a/molecule/cloud-aws-zulu-12/molecule.yml +++ b/molecule/cloud-aws-zulu-12/molecule.yml @@ -68,7 +68,7 @@ provisioner: group_vars: zulu: java_distribution: zulu - transport: zulu-fallback + transport: fallback playbooks: create: ../resources/provisioning/AWS/create.yml prepare: ../resources/provisioning/AWS/prepare.yml diff --git a/molecule/cloud-azure-adoptopenjdk-windows/molecule.yml b/molecule/cloud-azure-adoptopenjdk-windows/molecule.yml index f0571059..863961bf 100644 --- a/molecule/cloud-azure-adoptopenjdk-windows/molecule.yml +++ b/molecule/cloud-azure-adoptopenjdk-windows/molecule.yml @@ -10,10 +10,11 @@ lint: options: config-file: .yamllint platforms: - - name: test-azure-windows2016-adoptopenjdk-tarball-13 + - name: test-azure-windows2016-adoptopenjdk-tarball-11 platform: windows2016core vm_size: Standard_D2s_v3 az_location: northeurope + assign_public_ip: true az_resource_group_name: epm-ldi az_virtual_network_name: epm-ldi-northeurope-vnet az_subnet_name: epm-ldi-northeurope-subnet @@ -25,10 +26,11 @@ platforms: - jdk - adoptopenjdk_fallback - - name: test-azure-windows2019-adoptopenjdk-tarball-13 + - name: test-azure-windows2019-adoptopenjdk-tarball-11 platform: windows2019core vm_size: Standard_D2s_v3 az_location: northeurope + assign_public_ip: true az_resource_group_name: epm-ldi az_virtual_network_name: epm-ldi-northeurope-vnet az_subnet_name: epm-ldi-northeurope-subnet @@ -44,6 +46,7 @@ platforms: platform: windows2016core vm_size: Standard_D2s_v3 az_location: northeurope + assign_public_ip: true az_resource_group_name: epm-ldi az_virtual_network_name: epm-ldi-northeurope-vnet az_subnet_name: epm-ldi-northeurope-subnet @@ -59,6 +62,7 @@ platforms: platform: windows2019core vm_size: Standard_D2s_v3 az_location: northeurope + assign_public_ip: true az_resource_group_name: epm-ldi az_virtual_network_name: epm-ldi-northeurope-vnet az_subnet_name: epm-ldi-northeurope-subnet @@ -77,7 +81,6 @@ provisioner: group_vars: adoptopenjdk: java_distribution: adoptopenjdk - java_major_version: 13 jdk: java_package: jdk jre: @@ -87,9 +90,11 @@ provisioner: hotspot: adoptopenjdk_impl: hotspot adoptopenjdk_fallback: - transport: adoptopenjdk-fallback + transport: fallback + java_major_version: 11 chocolatey: transport: chocolatey + java_major_version: 13 windows: ansible_password: "{{ lookup('env', 'WINRM_ADMIN_PWD') | default('M0leCule123!', true) }}" ansible_winrm_transport: credssp diff --git a/molecule/cloud-azure-sapmachine-windows/molecule.yml b/molecule/cloud-azure-sapmachine-windows/molecule.yml index a8decf6e..ffd0f7ee 100644 --- a/molecule/cloud-azure-sapmachine-windows/molecule.yml +++ b/molecule/cloud-azure-sapmachine-windows/molecule.yml @@ -42,6 +42,7 @@ platforms: - sapmachine_fallback - ver11 +# todo: enable after fix! - name: test-azure-windows2019-sapmachine-chocolatey-13 platform: windows2019core vm_size: Standard_D2s_v3 @@ -70,7 +71,7 @@ provisioner: ver13: java_major_version: 13 sapmachine_fallback: - transport: sapmachine-fallback + transport: fallback chocolatey: transport: chocolatey windows: diff --git a/molecule/cloud-azure-windows-8/molecule.yml b/molecule/cloud-azure-windows-8/molecule.yml index 73a3bf6c..5fbdd1c7 100644 --- a/molecule/cloud-azure-windows-8/molecule.yml +++ b/molecule/cloud-azure-windows-8/molecule.yml @@ -59,7 +59,7 @@ provisioner: transport_web: "https://storage11490.blob.core.windows.net/\ oracle-java/jdk-8u45-windows-x64.exe?\ {{ hostvars['localhost']['storage_sig']['response']['serviceSasToken'] }}" - java_unlimited_policy_transport: oracle-fallback + java_unlimited_policy_transport: fallback java_unlimited_policy_enabled: true playbooks: create: ../resources/provisioning/AZURE/create.yml diff --git a/molecule/cloud-azure-windows-corretto/molecule.yml b/molecule/cloud-azure-windows-corretto/molecule.yml new file mode 100644 index 00000000..feb53337 --- /dev/null +++ b/molecule/cloud-azure-windows-corretto/molecule.yml @@ -0,0 +1,106 @@ +--- +dependency: + name: galaxy + options: + role-file: requirements.yml +driver: + name: ec2 +lint: + name: yamllint + options: + config-file: .yamllint +platforms: + - name: test-azure-windows2016-corretto-11-fb-msi + platform: windows2016core + vm_size: Standard_D2s_v3 + assign_public_ip: false + az_location: northeurope + az_resource_group_name: epm-ldi + az_virtual_network_name: epm-ldi-northeurope-vnet + az_subnet_name: epm-ldi-northeurope-subnet + az_network_security_group: epm-ldi-northeurope-sg + groups: + - windows + - corretto + - msi + - java11 + + - name: test-azure-windows2019-corretto-11-fb-msi + platform: windows2019core + vm_size: Standard_D2s_v3 + assign_public_ip: false + az_location: northeurope + az_resource_group_name: epm-ldi + az_virtual_network_name: epm-ldi-northeurope-vnet + az_subnet_name: epm-ldi-northeurope-subnet + az_network_security_group: epm-ldi-northeurope-sg + groups: + - windows + - corretto + - msi + - java11 + + - name: test-azure-windows2016-corretto-8-fb-msi + platform: windows2016core + vm_size: Standard_D2s_v3 + assign_public_ip: false + az_location: northeurope + az_resource_group_name: epm-ldi + az_virtual_network_name: epm-ldi-northeurope-vnet + az_subnet_name: epm-ldi-northeurope-subnet + az_network_security_group: epm-ldi-northeurope-sg + groups: + - windows + - corretto + - msi + - java8 + + - name: test-azure-windows2019-corretto-8-fb-msi + platform: windows2019core + vm_size: Standard_D2s_v3 + assign_public_ip: false + az_location: northeurope + az_resource_group_name: epm-ldi + az_virtual_network_name: epm-ldi-northeurope-vnet + az_subnet_name: epm-ldi-northeurope-subnet + az_network_security_group: epm-ldi-northeurope-sg + groups: + - windows + - corretto + - msi + - java8 + +provisioner: + name: ansible + log: true + config_options: + defaults: + callback_whitelist: profile_tasks,timer + inventory: + group_vars: + windows: + ansible_connection: winrm + ansible_password: "{{ lookup('env', 'WINRM_ADMIN_PWD') | default('M0leCule123!', true) }}" + ansible_winrm_transport: credssp + ansible_winrm_server_cert_validation: ignore + corretto: + java_distribution: corretto + transport: fallback + msi: + java_tarball_install: false + java8: + java_major_version: 8 + java11: + java_major_version: 11 + playbooks: + create: ../resources/provisioning/AZURE/create.yml + destroy: ../resources/provisioning/AZURE/destroy.yml + verify: ../resources/tests/verify_win.yml + lint: + name: ansible-lint +scenario: + name: cloud-azure-windows-corretto +verifier: + name: ansible + lint: + name: ansible-lint diff --git a/molecule/cloud-azure-windows-corretto/playbook.yml b/molecule/cloud-azure-windows-corretto/playbook.yml new file mode 100644 index 00000000..2bd7212e --- /dev/null +++ b/molecule/cloud-azure-windows-corretto/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: ansible-role-java diff --git a/molecule/cloud-azure-windows-sapjvm-8/molecule.yml b/molecule/cloud-azure-windows-sapjvm-8/molecule.yml index 3699e3c8..56623d5a 100644 --- a/molecule/cloud-azure-windows-sapjvm-8/molecule.yml +++ b/molecule/cloud-azure-windows-sapjvm-8/molecule.yml @@ -51,7 +51,7 @@ provisioner: ansible_winrm_server_cert_validation: ignore sapjvm: java_distribution: sapjvm - transport: sapjvm-fallback + transport: fallback java_major_version: 8 playbooks: create: ../resources/provisioning/AZURE/create.yml diff --git a/molecule/cloud-azure-windows-zulu-12/molecule.yml b/molecule/cloud-azure-windows-zulu-12/molecule.yml index 78335207..46de6460 100644 --- a/molecule/cloud-azure-windows-zulu-12/molecule.yml +++ b/molecule/cloud-azure-windows-zulu-12/molecule.yml @@ -51,7 +51,7 @@ provisioner: ansible_winrm_server_cert_validation: ignore zulu: java_distribution: zulu - transport: zulu-fallback + transport: fallback playbooks: create: ../resources/provisioning/AZURE/create.yml destroy: ../resources/provisioning/AZURE/destroy.yml diff --git a/molecule/resources/prepare.yml b/molecule/resources/prepare.yml new file mode 100644 index 00000000..32a624f2 --- /dev/null +++ b/molecule/resources/prepare.yml @@ -0,0 +1,12 @@ +--- +- name: Add epel + hosts: centos8 + tasks: + - name: Enable EPEL repository + dnf: + name: 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm' + state: present + update_cache: true + register: status + until: status is succeeded + become: true diff --git a/tasks/Linux/fetch/adoptopenjdk-fallback.yml b/tasks/Linux/fetch/adoptopenjdk-fallback.yml index d356a261..a5cd0c65 100644 --- a/tasks/Linux/fetch/adoptopenjdk-fallback.yml +++ b/tasks/Linux/fetch/adoptopenjdk-fallback.yml @@ -32,14 +32,15 @@ - name: 'Get artifact checksum from file {{ release_url[1] }}' set_fact: artifact_checksum: >- - {{ artifact_checksum_file['content'] | - regex_search('([^\s]+)') - }} + {{ artifact_checksum_file['content'] + | regex_search('([^\s]+)') }} + java_downloaded_file: >- + {{ (release_url[0]|urlsplit).path|basename }} - name: 'Download artifact from {{ release_url[0] }}' get_url: url: '{{ release_url[0] }}' - dest: '{{ java_download_path }}' + dest: '{{ java_download_path }}/{{ java_downloaded_file }}' checksum: 'sha256:{{ artifact_checksum }}' register: file_downloaded retries: 20 diff --git a/tasks/Linux/fetch/corretto-fallback.yml b/tasks/Linux/fetch/corretto-fallback.yml new file mode 100644 index 00000000..89280b3b --- /dev/null +++ b/tasks/Linux/fetch/corretto-fallback.yml @@ -0,0 +1,42 @@ +--- +- name: Check requested major version for Corretto + fail: + msg: Supported versions of Amazon Corretto only 8 and 11 + when: + - java_major_version|int != 8 + - java_major_version|int != 11 + +- name: Check requested architecture for Corretto + fail: + msg: Amazon Corretto currently supports x64 platform only + when: java_arch != 'x64' + +- name: 'Fetch root page {{ corretto_root_page }}' + uri: + url: '{{ corretto_root_page }}' + return_content: true + register: root_page + +- name: Find release url + set_fact: + release_url: >- + {{ root_page['content'] + | regex_search('(https://corretto.aws/downloads/latest/amazon-corretto-' + ~ java_major_version ~ '-' ~ java_arch ~ '-linux-' ~ java_package ~'\.' ~ java_package_type ~')') + }} + release_checksum: >- + {{ root_page['content'] + | regex_search('(https://corretto.aws/downloads/latest_checksum/amazon-corretto-' + ~ java_major_version ~ '-' ~ java_arch ~ '-linux-' ~ java_package ~ '\.' ~ java_package_type ~')') + }} + +- name: 'Download artifact from {{ release_url }}' + get_url: + url: '{{ release_url }}' + dest: '{{ java_download_path }}/{{ (release_url|urlsplit).path|basename }}' + checksum: >- + md5:{{ lookup('url', release_checksum) }} + register: file_downloaded + retries: 20 + delay: 5 + until: file_downloaded is succeeded diff --git a/tasks/Linux/fetch/dragonwell8-fallback.yml b/tasks/Linux/fetch/dragonwell8-fallback.yml index 02ff61f5..d5da308d 100644 --- a/tasks/Linux/fetch/dragonwell8-fallback.yml +++ b/tasks/Linux/fetch/dragonwell8-fallback.yml @@ -17,7 +17,7 @@ - name: Fetch Dragonwell version by tag uri: - url: "{{ github_api_page }}/repos/alibaba/dragonwell8/releases/{{ sub_uri }}" + url: '{{ github_api_page }}/repos/alibaba/dragonwell8/releases/{{ sub_uri }}' return_content: true body_format: json status_code: [200, 404] # Not found case we are handling below @@ -28,20 +28,16 @@ msg: 'Dragonwell version {{ java_major_version }}.{{ java_minor_version }} not found' when: response.status == 404 -# Transform Release name to Asset name -# Release name sample: Alibaba Dragonwell 8.1.1-GA -# Asset name sample: Alibaba_Dragonwell_8.1.1-GA_Linux_x64.tar.gz -- name: Prepare release asset name - set_fact: - asset_name: "{{ (response.json.name | regex_replace(' ', '_')) + '_Linux_x64.tar.gz' }}" - - name: Get release URL set_fact: - release_url: "{{ response.json | json_query(\"assets[?name=='\" + asset_name + \"'].browser_download_url\") }}" + release_url: >- + {{ response.json.assets + | selectattr('browser_download_url', 'match', '.*_Linux_x64\.tar\.gz') + | map(attribute='browser_download_url') | list | first }} - name: Download artifact from {{ release_url[0] }} get_url: - url: '{{ release_url[0] }}' + url: '{{ release_url }}' dest: '{{ java_download_path }}' register: file_downloaded retries: 20 diff --git a/tasks/Linux/fetch/openjdk-fallback.yml b/tasks/Linux/fetch/openjdk-fallback.yml index f421a24a..abd6a657 100644 --- a/tasks/Linux/fetch/openjdk-fallback.yml +++ b/tasks/Linux/fetch/openjdk-fallback.yml @@ -47,7 +47,7 @@ - name: 'Download artifact from {{ release_url[0] }}' get_url: url: '{{ release_url[0] }}' - dest: '{{ java_download_path }}' + dest: '{{ java_download_path }}/{{ (release_url[0]|urlsplit).path|basename }}' checksum: 'sha256:{{ artifact_checksum.content }}' register: file_downloaded retries: 20 diff --git a/tasks/Linux/fetch/sapmachine-fallback.yml b/tasks/Linux/fetch/sapmachine-fallback.yml index c1da19f1..782609ea 100644 --- a/tasks/Linux/fetch/sapmachine-fallback.yml +++ b/tasks/Linux/fetch/sapmachine-fallback.yml @@ -16,7 +16,7 @@ - name: 'Fetch artifact page' uri: - url: '{{ release_page }}' + url: '{{ java_sapmachine_release_page }}' status_code: [200, 404] return_content: true body_format: json @@ -30,15 +30,12 @@ + '_' + java_arch|string + ' for Linux is not supported!' }} when: artifact_page.status == 404 -- name: Get artifact link +- name: Get artifact and checksum link set_fact: - artifact_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + release_name + \".tar.gz'].browser_download_url\") }}" + release_url: "{{ artifact_page.json | json_query(\"assets[?name=='\" + java_sapmachine_release_name + \".tar.gz'].browser_download_url\") }}" + checksum_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + java_sapmachine_release_name + \".sha256.txt'].browser_download_url\") }}" -- name: Get checksum link - set_fact: - checksum_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + release_name + \".sha256.txt'].browser_download_url\") }}" - -- name: 'Fetch artifact checksum file' +- name: Fetch artifact checksum file uri: url: '{{ checksum_link[0] }}' return_content: true @@ -49,10 +46,10 @@ artifact_checksum: >- {{ artifact_checksum_file.content | regex_search('(^\w*)') }} -- name: 'Download artifact' +- name: Download artifact get_url: - url: '{{ artifact_link[0] }}' - dest: '{{ java_download_path }}' + url: '{{ release_url[0] }}' + dest: '{{ java_download_path }}/{{ (release_url[0]|urlsplit).path|basename }}' checksum: 'sha256:{{ artifact_checksum }}' register: file_downloaded retries: 20 diff --git a/tasks/Linux/fetch/security-fetch/security-fetch-oracle-fallback.yml b/tasks/Linux/fetch/security-fetch/security-fetch-oracle_java-fallback.yml similarity index 100% rename from tasks/Linux/fetch/security-fetch/security-fetch-oracle-fallback.yml rename to tasks/Linux/fetch/security-fetch/security-fetch-oracle_java-fallback.yml diff --git a/tasks/Linux/fetch/zulu-fallback.yml b/tasks/Linux/fetch/zulu-fallback.yml index 0002ab78..dc924182 100644 --- a/tasks/Linux/fetch/zulu-fallback.yml +++ b/tasks/Linux/fetch/zulu-fallback.yml @@ -1,5 +1,5 @@ --- -- name: 'Fetch download page' +- name: Fetch download page uri: url: "{{ zulu_api_page }}\ /bundles/latest/\ @@ -10,14 +10,11 @@ follow_redirects: all register: root_page -- name: Find release url +- name: Find release url and artifact_checksum set_fact: release_url: >- {{ (root_page.content | from_json).url }} - -- name: Find checksum - set_fact: - checksum: >- + artifact_checksum: >- {{ (root_page.content | from_json).md5_hash }} - name: Exit if Zulu version is not found @@ -28,8 +25,8 @@ - name: 'Download artifact from {{ release_url }}' get_url: url: '{{ release_url }}' - dest: '{{ java_download_path }}' - checksum: 'md5:{{ checksum }}' + dest: '{{ java_download_path }}/{{ (release_url|urlsplit).path|basename }}' + checksum: 'md5:{{ artifact_checksum }}' register: file_downloaded retries: 20 delay: 5 diff --git a/tasks/Linux/finalize_paths.yml b/tasks/Linux/finalize_paths.yml index ff6220a8..c3e0967a 100644 --- a/tasks/Linux/finalize_paths.yml +++ b/tasks/Linux/finalize_paths.yml @@ -1,44 +1,48 @@ --- -- name: Find java_folder - find: - paths: '{{ java_path }}' - recurse: false - file_type: directory - patterns: '{{ java_folder }}' - use_regex: true - register: java_dir +- name: Become block + block: + - name: Find java_folder + find: + paths: '{{ java_path }}' + recurse: false + file_type: directory + patterns: '{{ java_folder }}' + use_regex: true + register: java_dir -- name: Set actual java directory - set_fact: - java_folder: "{{ java_dir.files | map(attribute='path') | list | last | basename }}" + - name: Set actual java directory + set_fact: + java_folder: >- + {{ java_dir.files | map(attribute='path') | list | last | basename }} -- name: Put java profile - template: - src: java.sh.j2 - dest: /etc/profile.d/java.sh - owner: root - group: root - mode: 0555 + - name: Put java profile + template: + src: java.sh.j2 + dest: /etc/profile.d/java.sh + owner: root + group: root + mode: 0555 -- name: Check for java binaries existence - stat: - path: '{{ java_path }}/{{ java_folder }}/bin/{{ binary }}' - register: java_binary_collection - loop: - - java - - javac - - jar - - keytool - loop_control: - loop_var: binary + - name: Check for java binaries existence + stat: + path: '{{ java_path }}/{{ java_folder }}/bin/{{ binary }}' + register: java_binary_collection + loop: + - java + - javac + - jar + - keytool + loop_control: + loop_var: binary -- name: Update alternatives - alternatives: - name: '{{ java_item.binary }}' - path: '{{ java_path }}/{{ java_folder }}/bin/{{ java_item.binary }}' - link: '/usr/bin/{{ java_item.binary }}' - priority: 100 - when: java_item.stat.exists | bool - loop: '{{ java_binary_collection.results }}' - loop_control: - loop_var: java_item + - name: Update alternatives + alternatives: + name: '{{ java_item.binary }}' + path: '{{ java_path }}/{{ java_folder }}/bin/{{ java_item.binary }}' + link: '/usr/bin/{{ java_item.binary }}' + priority: 100 + when: java_item.stat.exists | bool + loop: '{{ java_binary_collection.results }}' + loop_control: + loop_var: java_item + become: true diff --git a/tasks/Linux/install/Amazon_2_corretto_8.yml b/tasks/Linux/install/Amazon_2_corretto_8.yml new file mode 100644 index 00000000..e12b0115 --- /dev/null +++ b/tasks/Linux/install/Amazon_2_corretto_8.yml @@ -0,0 +1,15 @@ +--- +# Amazon Corretto 8 specific +# Installing on Amazon Linux 2 from repo +# https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/amazon-linux-install.html +# As we cannot use amazon-linux-extras with Ansible, we're adding Amazon corretto8 repo manually +- name: Add Amazon yum repository for corretto8 + yum_repository: + name: amazon-corretto8 + description: Amazon Extras repo for corretto8 + mirrorlist: http://amazonlinux.$awsregion.$awsdomain/$releasever/extras/corretto8/latest/$basearch/mirror.list + priority: 10 + +# Install in any case via Yum +- name: 'Install Corretto {{ java_major_version }}' + include_tasks: RedHat.yml diff --git a/tasks/Linux/install/Debian.yml b/tasks/Linux/install/Debian.yml index 59e5957c..7ee641ec 100644 --- a/tasks/Linux/install/Debian.yml +++ b/tasks/Linux/install/Debian.yml @@ -1,8 +1,8 @@ --- - name: Install java packages apt: - deb: '{{ java_artifact | default(omit) }}' - name: '{{ (jdk_package if transport == "repositories") | default(omit) }}' + deb: '{{ java_artifact | default(omit, true) }}' + name: '{{ (jdk_package if transport == "repositories") | default(omit, true) }}' state: present update_cache: true cache_valid_time: 3600 diff --git a/tasks/Linux/install/Debian_adoptopenjdk.yml b/tasks/Linux/install/Debian_adoptopenjdk.yml index 5472ec21..240b8898 100644 --- a/tasks/Linux/install/Debian_adoptopenjdk.yml +++ b/tasks/Linux/install/Debian_adoptopenjdk.yml @@ -16,8 +16,8 @@ - name: Install java packages apt: - deb: '{{ java_artifact | default(omit) }}' - name: '{{ (jdk_package if transport == "repositories") | default(omit) }}' + deb: '{{ java_artifact | default(omit, true) }}' + name: '{{ (jdk_package if transport == "repositories") | default(omit, true) }}' state: present update_cache: true cache_valid_time: 3600 diff --git a/tasks/Linux/install/RedHat.yml b/tasks/Linux/install/RedHat.yml index 7d673dfe..e0b18a03 100644 --- a/tasks/Linux/install/RedHat.yml +++ b/tasks/Linux/install/RedHat.yml @@ -1,7 +1,17 @@ --- +- name: debug jdk_package + debug: + var: jdk_package + +- name: debug java_artifact + debug: + var: java_artifact + - name: Install java packages yum: name: '{{ (transport == "repositories") | ternary(jdk_package, java_artifact) }}' state: present register: package_install + retries: 20 + delay: 5 until: package_install is succeeded diff --git a/tasks/Linux/install/RedHat_adoptopenjdk.yml b/tasks/Linux/install/RedHat_adoptopenjdk.yml index c907de07..90be6b81 100644 --- a/tasks/Linux/install/RedHat_adoptopenjdk.yml +++ b/tasks/Linux/install/RedHat_adoptopenjdk.yml @@ -3,7 +3,8 @@ yum_repository: name: AdoptOpenJDK description: AdoptOpenJDK - baseurl: http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/7/x86_64 + baseurl: "http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/\ + {{ rh_dist_repo_version }}/x86_64" enabled: true gpgcheck: true gpgkey: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public diff --git a/tasks/Linux/install/tarball.yml b/tasks/Linux/install/tarball.yml index 20e1017d..31f536fd 100644 --- a/tasks/Linux/install/tarball.yml +++ b/tasks/Linux/install/tarball.yml @@ -1,4 +1,5 @@ --- + - name: Mkdir for java installation file: path: '{{ java_path }}/{{ java_folder }}' diff --git a/tasks/Linux/security_policy.yml b/tasks/Linux/security_policy.yml index 6e9e23b8..c19227d5 100644 --- a/tasks/Linux/security_policy.yml +++ b/tasks/Linux/security_policy.yml @@ -3,6 +3,7 @@ include_tasks: '{{ transport_driver }}' with_first_found: - 'fetch/security-fetch/security-fetch-{{ java_unlimited_policy_transport }}.yml' + - 'fetch/security-fetch/security-fetch-{{ java_distribution }}-{{ java_unlimited_policy_transport }}.yml' - 'fetch/unknown-transport.yml' loop_control: loop_var: transport_driver diff --git a/tasks/Linux/system.yml b/tasks/Linux/system.yml index 942b93e3..435eaba2 100644 --- a/tasks/Linux/system.yml +++ b/tasks/Linux/system.yml @@ -1,14 +1,15 @@ --- -- name: Set parse variables based on java distribution - include_vars: java_parts.yml - - name: Perform install from artifacts block: - name: Install requirements package: - name: '{{ java_package_requirements }}' + name: >- + {{ java_package_requirements + | union(java_extra_package_requirements) | unique }} state: present register: installed_packages + retries: 10 + delay: 5 until: installed_packages is succeeded when: transport != 'repositories' @@ -20,7 +21,4 @@ - 'install/{{ ansible_os_family }}.yml' loop_control: loop_var: install_task - - - name: Finalize binary paths - include_tasks: finalize_paths.yml become: true diff --git a/tasks/Linux/system_repositories.yml b/tasks/Linux/system_repositories.yml index 2412c938..ff3b631f 100644 --- a/tasks/Linux/system_repositories.yml +++ b/tasks/Linux/system_repositories.yml @@ -4,11 +4,9 @@ - name: 'Perform repo install' include_tasks: '{{ install_task }}' with_first_found: + - 'install/{{ ansible_distribution }}_{{ ansible_distribution_version }}_{{ java_distribution }}_{{ java_major_version }}.yml' - 'install/{{ ansible_os_family }}_{{ java_distribution }}.yml' - 'install/{{ ansible_os_family }}.yml' loop_control: loop_var: install_task - - - name: Finalize binary paths - include_tasks: finalize_paths.yml become: true diff --git a/tasks/Win32NT/fetch/adoptopenjdk-fallback.yml b/tasks/Win32NT/fetch/adoptopenjdk-fallback.yml index 9d082d70..9601f443 100644 --- a/tasks/Win32NT/fetch/adoptopenjdk-fallback.yml +++ b/tasks/Win32NT/fetch/adoptopenjdk-fallback.yml @@ -49,8 +49,3 @@ retries: 20 delay: 5 until: file_downloaded is succeeded - when: ansible_version.full is version('2.8.0', '>=') - -- name: Old fetch (Ansible < 2.8) - include_tasks: fetch_fallback_old.yml - when: ansible_version.full is version('2.8.0', '<') diff --git a/tasks/Win32NT/fetch/corretto-fallback.yml b/tasks/Win32NT/fetch/corretto-fallback.yml new file mode 100644 index 00000000..490b6dee --- /dev/null +++ b/tasks/Win32NT/fetch/corretto-fallback.yml @@ -0,0 +1,43 @@ +--- +- name: Check requested major version for Corretto + fail: + msg: Supported versions of Amazon Corretto only 8 and 11 + when: + - java_major_version|int != 8 + - java_major_version|int != 11 + +- name: Check requested architecture for Corretto + fail: + msg: Amazon Corretto currently supports x64 platform only + when: java_arch != 'x64' + +- name: 'Fetch root page {{ corretto_root_page }}' + win_uri: + url: '{{ corretto_root_page }}' + return_content: true + register: root_page + +- name: Find release url + set_fact: + release_url: >- + {{ root_page['content'] + | regex_search('(https://corretto.aws/downloads/latest/amazon-corretto-' + ~ java_major_version ~ '-' ~ java_arch ~ '-windows-' ~ java_package ~'\.' ~ java_package_type ~')') + }} + release_checksum: >- + {{ root_page['content'] + | regex_search('(https://corretto.aws/downloads/latest_checksum/amazon-corretto-' + ~ java_major_version ~ '-' ~ java_arch ~ '-windows-' ~ java_package ~ '\.' ~ java_package_type ~')') + }} + +- name: 'Download artifact from {{ release_url }}' + win_get_url: + url: '{{ release_url }}' + dest: '{{ java_download_path }}\{{ (release_url|urlsplit).path|basename }}' + checksum: >- + {{ lookup('url', release_checksum) }} + checksum_algorithm: md5 + register: file_downloaded + retries: 20 + delay: 5 + until: file_downloaded is succeeded diff --git a/tasks/Win32NT/fetch/fetch_checksum.yml b/tasks/Win32NT/fetch/fetch_checksum.yml deleted file mode 100644 index 8b2f6721..00000000 --- a/tasks/Win32NT/fetch/fetch_checksum.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: 'Download artifact from {{ artifact_url }}' - win_get_url: - url: '{{ artifact_url }}' - dest: '{{ java_download_path }}\{{ artifact_basename }}' - force: true - -- name: 'Get {{ checksum_alg }} checksum of file' - win_stat: - path: '{{ java_download_path }}\{{ artifact_basename }}' - get_checksum: true - checksum_algorithm: '{{ checksum_alg }}' - register: artifact diff --git a/tasks/Win32NT/fetch/fetch_fallback_old.yml b/tasks/Win32NT/fetch/fetch_fallback_old.yml deleted file mode 100644 index ebdae526..00000000 --- a/tasks/Win32NT/fetch/fetch_fallback_old.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Set artifact basename - set_fact: - artifact_url: '{{ release_url[0] }}' - artifact_basename: "{{ (release_url[0] | urlsplit('path')).split('/')[-1] }}" - -- name: 'Get {{ checksum_alg }} checksum of file' - win_stat: - path: '{{ java_download_path }}\{{ artifact_basename }}' - get_checksum: true - checksum_algorithm: '{{ checksum_alg }}' - register: artifact - -- name: Download with checksum validation - include_tasks: fetch_checksum.yml - when: | - not artifact.stat.exists | bool - or artifact.stat.checksum != artifact_checksum.content - retries: 15 - delay: 2 - until: artifact.stat.checksum == artifact_checksum.content - -- name: Set downloaded artifact vars - set_fact: - file_downloaded: - dest: '{{ artifact.stat.path }}' diff --git a/tasks/Win32NT/fetch/openjdk-fallback.yml b/tasks/Win32NT/fetch/openjdk-fallback.yml index 2bb98844..db8a3a1d 100644 --- a/tasks/Win32NT/fetch/openjdk-fallback.yml +++ b/tasks/Win32NT/fetch/openjdk-fallback.yml @@ -50,7 +50,7 @@ - name: 'Download artifact from {{ release_url[0] }}' win_get_url: url: '{{ release_url[0] }}' - dest: '{{ java_download_path }}' + dest: '{{ java_download_path }}\{{ (release_url[0]|urlsplit).path|basename }}' force: true checksum: '{{ artifact_checksum.content }}' checksum_algorithm: sha256 @@ -58,8 +58,3 @@ retries: 20 delay: 5 until: file_downloaded is succeeded - when: ansible_version.full is version('2.8.0', '>=') - -- name: Old fetch (Ansible < 2.8) - include_tasks: fetch_fallback_old.yml - when: ansible_version.full is version('2.8.0', '<') diff --git a/tasks/Win32NT/fetch/sapmachine-fallback.yml b/tasks/Win32NT/fetch/sapmachine-fallback.yml index 0f9aa7c7..949899b1 100644 --- a/tasks/Win32NT/fetch/sapmachine-fallback.yml +++ b/tasks/Win32NT/fetch/sapmachine-fallback.yml @@ -16,7 +16,7 @@ - name: 'Fetch artifact page' win_uri: - url: '{{ release_page }}' + url: '{{ java_sapmachine_release_page }}' status_code: [200, 404] return_content: true headers: {"user-agent": "Mozilla/5.0"} @@ -32,11 +32,11 @@ - name: Get artifact link set_fact: - artifact_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + release_name + \".zip'].browser_download_url\") }}" + artifact_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + java_sapmachine_release_name + \".zip'].browser_download_url\") }}" - name: Get checksum link set_fact: - checksum_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + release_name + \".sha256.txt'].browser_download_url\") }}" + checksum_link: "{{ artifact_page.json | json_query(\"assets[?name=='\" + java_sapmachine_release_name + \".sha256.txt'].browser_download_url\") }}" - name: 'Fetch artifact checksum file' win_uri: diff --git a/tasks/Win32NT/fetch/security-fetch/security-winfetch-oracle-fallback.yml b/tasks/Win32NT/fetch/security-fetch/security-winfetch-oracle_java-fallback.yml similarity index 100% rename from tasks/Win32NT/fetch/security-fetch/security-winfetch-oracle-fallback.yml rename to tasks/Win32NT/fetch/security-fetch/security-winfetch-oracle_java-fallback.yml diff --git a/tasks/Win32NT/fetch/zulu-fallback.yml b/tasks/Win32NT/fetch/zulu-fallback.yml index 79ba969c..16bd537e 100644 --- a/tasks/Win32NT/fetch/zulu-fallback.yml +++ b/tasks/Win32NT/fetch/zulu-fallback.yml @@ -23,13 +23,8 @@ dest: '{{ java_download_path }}' force: true checksum: '{{ artifact_checksum }}' - checksum_algorithm: '{{ checksum_alg }}' + checksum_algorithm: md5 register: file_downloaded retries: 20 delay: 5 until: file_downloaded is succeeded - when: ansible_version.full is version('2.8.0', '>=') - -- name: Old fetch (Ansible < 2.8) - include_tasks: fetch_fallback_old.yml - when: ansible_version.full is version('2.8.0', '<') diff --git a/tasks/Win32NT/finalize_paths.yml b/tasks/Win32NT/finalize_paths.yml index 1fd66adb..0b7194cf 100644 --- a/tasks/Win32NT/finalize_paths.yml +++ b/tasks/Win32NT/finalize_paths.yml @@ -10,7 +10,8 @@ - name: Set actual java directory set_fact: - java_act_path: "{{ java_dir.files | map(attribute='path') | list | last }}" + java_act_path: >- + {{ java_dir.files | map(attribute='path') | list | last }} - name: Set java environment variable win_environment: diff --git a/tasks/Win32NT/install/corretto_package.yml b/tasks/Win32NT/install/corretto_package.yml new file mode 100644 index 00000000..fb890823 --- /dev/null +++ b/tasks/Win32NT/install/corretto_package.yml @@ -0,0 +1,6 @@ +--- +- name: Install java packages + win_package: + path: '{{ java_artifact }}' + product_id: '{{ java_product_id }}' + state: present diff --git a/tasks/Win32NT/security_policy.yml b/tasks/Win32NT/security_policy.yml index d027daa5..dd43322c 100644 --- a/tasks/Win32NT/security_policy.yml +++ b/tasks/Win32NT/security_policy.yml @@ -3,6 +3,7 @@ include_tasks: '{{ transport_driver }}' with_first_found: - 'fetch/security-fetch/security-winfetch-{{ java_unlimited_policy_transport }}.yml' + - 'fetch/security-fetch/security-winfetch-{{ java_distribution }}-{{ java_unlimited_policy_transport }}.yml' - 'fetch/unknown-transport.yml' loop_control: loop_var: transport_driver diff --git a/tasks/Win32NT/system.yml b/tasks/Win32NT/system.yml index 460c2014..89b000dc 100644 --- a/tasks/Win32NT/system.yml +++ b/tasks/Win32NT/system.yml @@ -1,7 +1,4 @@ --- -- name: Set parse variables based on java distribution - include_vars: java_parts.yml - - name: 'Perform {{ java_binary_type }} install' include_tasks: '{{ install_task }}' with_first_found: @@ -9,6 +6,3 @@ - 'install/{{ java_binary_type }}.yml' loop_control: loop_var: install_task - -- name: Finalize binary paths - include_tasks: finalize_paths.yml diff --git a/tasks/Win32NT/system_chocolatey.yml b/tasks/Win32NT/system_chocolatey.yml index 0c64ea40..89b000dc 100644 --- a/tasks/Win32NT/system_chocolatey.yml +++ b/tasks/Win32NT/system_chocolatey.yml @@ -6,6 +6,3 @@ - 'install/{{ java_binary_type }}.yml' loop_control: loop_var: install_task - -- name: Finalize binary paths - include_tasks: finalize_paths.yml diff --git a/tasks/main.yml b/tasks/main.yml index cdfd8add..3b171dbe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,6 +13,7 @@ - name: 'Fetch oracle artifact with {{ transport }} transport' include_tasks: '{{ transport_driver }}' with_first_found: + - '{{ ansible_system }}/fetch/{{ java_distribution }}-{{ transport }}.yml' - '{{ ansible_system }}/fetch/{{ transport }}.yml' - unknown-transport.yml loop_control: @@ -28,6 +29,10 @@ loop_control: loop_var: platform +- name: Finalize binary paths + include_tasks: '{{ ansible_system }}/finalize_paths.yml' + when: java_setup_path | bool + - name: Apply security policy patch include_tasks: '{{ platform }}' with_first_found: @@ -36,5 +41,6 @@ loop_control: loop_var: platform when: + - java_setup_path - java_unlimited_policy_enabled - java_distribution == 'oracle_java' diff --git a/vars/Debian.yml b/vars/Debian.yml index 753cd782..6e8003ed 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -3,11 +3,17 @@ java_package_requirements: - unzip - rsync -jdk_package: >- +java_package_type: >- + {{ java_tarball_install | ternary('tar.gz', 'deb') }} + +jdk_package_openjdk: >- {{ 'openjdk-' + java_major_version|string + '-' + java_package }} java_default_path: /usr/lib/jvm +java_default_corretto_path: /usr/lib/jvm +java_corretto_folder: '{{ java_folder_ext_transport }}' + java_folder_repo_transport: >- {{ 'java-' + java_major_version|string + '-openjdk-*' | default(omit) }} diff --git a/vars/RedHat.yml b/vars/RedHat.yml index 98a8e6bc..4bc1f72a 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -4,30 +4,22 @@ java_package_requirements: - tar - rsync -# Variables for RHEL specific (example java-11-openjdk-devel.x86_64) -# Define Centos arch specific for compatibility with oracle packages name -openjdk_arch_rhel: '{{ (java_arch == "x64") | ternary("x86_64", "i686") }}' -# java-11-openjdk.x86_64 is OpenJDK Runtime Environment -# java-11-openjdk-devel.x86_64 : OpenJDK Development Environment 11 -# change variables for more compatibility jdk/jre -openjdk_package_rhel_spec: >- - {{ (java_package == 'jdk') - | ternary('openjdk-devel.' + openjdk_arch_rhel, - 'openjdk.' + openjdk_arch_rhel) - }} -# change java_major_version (if it 8) for rhel specific 1.8.0 -openjdk_package_rhel_versions: >- - {{ (java_major_version|int <= 8) - | ternary('1.' + java_major_version|string + '.0', - java_major_version|string) - }} +java_package_type: >- + {{ java_tarball_install | ternary('tar.gz', 'rpm') }} -jdk_package: >- + +rh_dist_repo_version: >- + {{ (ansible_distribution == 'Amazon') | ternary('7', ansible_distribution_major_version) }} + +jdk_package_openjdk: >- {{ 'java-' + openjdk_package_rhel_versions|string + '-' + openjdk_package_rhel_spec|string }} java_default_path: >- - {{ (java_distribution == 'zulu') | ternary('/usr/lib/jvm', '/usr/java') }} + {{ (java_distribution in ['zulu', 'corretto']) | ternary('/usr/lib/jvm', '/usr/java') }} +java_corretto_folder: '{{ java_folder_ext_transport }}' + +java_default_corretto_path: /usr/lib/jvm java_folder_repo_transport: >- {{ 'java-' + openjdk_package_rhel_versions diff --git a/vars/Windows.yml b/vars/Windows.yml index c1b9c19e..f2ee75d0 100644 --- a/vars/Windows.yml +++ b/vars/Windows.yml @@ -4,6 +4,9 @@ java_product_id_ver: 11: '{26A5A3EF-92DC-5243-ABF9-00B12A3DF649}' 12: '{0D60E96D-0B74-55A5-ACA5-0F6786FDF256}' +java_package_type: >- + {{ java_tarball_install | ternary('zip', 'msi') }} + checksum_alg: sha256 transport_web_default: https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip @@ -13,4 +16,12 @@ java_download_default_path: '{{ ansible_env.TEMP }}' java_default_path: >- {{ (transport == 'chocolatey') | ternary(choco_path | default(omit), 'C:\Program Files\Java') }} +java_default_corretto_path: C:\Program Files\Amazon Corretto + java_artifact_basename: '{{ java_artifact | win_basename }}' + +java_corretto_folder: >- + {{ (java_major_version|int == 8) + | ternary(java_package + '1.' + java_major_version|string + '.0_' + java_minor_version|string, + java_package ~ java_full_version|string) + }} diff --git a/vars/java_distro_configs/adoptopenjdk_vars.yml b/vars/java_distro_configs/adoptopenjdk_vars.yml index 1a87fa9b..63c70b9c 100644 --- a/vars/java_distro_configs/adoptopenjdk_vars.yml +++ b/vars/java_distro_configs/adoptopenjdk_vars.yml @@ -1,12 +1,18 @@ --- +adoptopenjdk_api_page: https://api.adoptopenjdk.net/v2/ parts: >- - {{ java_artifact_basename + {{ java_artifact_basename | default('undefined', true) | regex_findall('^OpenJ[DKRE]{1,2}[0-9]+U[\-]*([jdkre]+)' ~ '[\-_](x64)_(Linux|linux|windows)_(hotspot|openj9)' ~ '_([0-9]{1,2})[u_\.]{1}([^_]+)?(_\S+)?\.[t|z][\.argzip]+') + | default([[]], true) | first | list }} +java_minor_version: '{{ parts[5] | default("*") }}' +java_os: '{{ parts[3] }}' +java_arch: '{{ parts[1] | default("x64") }}' + java_package_suffix: >- {{ (java_major_version == 13) | ternary('', java_major_version) }} @@ -20,7 +26,7 @@ adoptopenjdk_choco_folder: >- {{ java_package ~ '[-]*' ~ java_major_version|string ~ '.*' }} adoptopenjdk_folder: >- - {{ (transport == 'chocolatey') | ternary(adoptopenjdk_choco_folder, java_folder_ext_transport|default('')) }} + {{ (transport == 'chocolatey') | ternary(adoptopenjdk_choco_folder, java_def_folder_ext_transport) }} jdk_package: >- {{ 'adoptopenjdk-' + java_major_version|string+ '-' + adoptopenjdk_impl|string diff --git a/vars/java_distro_configs/corretto_vars.yml b/vars/java_distro_configs/corretto_vars.yml new file mode 100644 index 00000000..3f5a90c8 --- /dev/null +++ b/vars/java_distro_configs/corretto_vars.yml @@ -0,0 +1,83 @@ +--- +corretto_root_page: https://docs.aws.amazon.com/corretto/latest/corretto-{{ java_major_version }}-ug/downloads-list.partial.html + +parts: >- + {{ java_artifact_basename | default('undefined', true) + | regex_findall('(java-[\d\.]+-)?amazon-corretto-?(devel-1\.|jdk_|devel-)?' + ~ '(\d+)[\d\.\-_b]*[-]*(linux|windows)?[-]*(amd64|x86_64|x64|arm64|aarch64)[-]*' + ~ '(linux|windows)?[-]*.*\.(deb|rpm|tar\.gz|msi|zip)') + | default([[]], true) | first | list }} + + +java_product_id_ver: + 8: '{0D179FFA-5BD7-4775-83C2-7770EFF5D7EC}' + 11: '{F8D0022C-B409-42FE-9124-CDE4F2F487E0}' + +jdk_package: >- + {{ (java_major_version|int == 11) | ternary(corretto11_package, corretto8_package) }} + +# Case #1. Install from repository on Amazon Linux 2 +# Allow to install Amazon Corretto 8 as JRE +# https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/amazon-linux-install.html +corretto8_package: >- + {{ (java_package == 'jdk') + | ternary('java-1.8.0-amazon-corretto-devel', + 'java-1.8.0-amazon-corretto') }} + +# Case #1. Install from repository on Amazon Linux 2 +# Amazon Corretto 11 has a 'headless' variant available. This variant omits runtime dependencies that are typically +# associated with GUI applications such as X11 and ALSA and is worth considering for server-oriented workloads. +# https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/amazon-linux-install.html +corretto11_package: "java-11-amazon-corretto-headless" + + +# {{ java_artifact_basename | regex_findall('(' + parts_pattern + ')') | first | list }} + +# Cases #2 and #3. Install from downloaded file either package (RPM or DEB) of tarball +# We need to know which file was downloaded + +parts_pattern: >- + {{ (transport == 'fallback') | ternary(parts_pattern_fallback, parts_pattern_web) }} + +# Case #2. Install from downloaded package (RPM or DEB) +# (java-[\d\.]+-)?amazon-corretto-?(devel-1\.|jdk_|devel-)?(\d+)[\d\.\-_b]*(-linux-|-windows-)?(amd64|x86_64|x64|arm64|aarch6)[-]*(linux|windows)?[-]*jdk\.(deb|rpm|tar\.gz|msi|zip) +# Parts are extracted from downloaded file name +# We're extracting only `java_major_version` and `java_minor_version` parts +# Downloaded DEB package name samples: +# java-1.8.0-amazon-corretto-jdk_8.232.09-1_amd64.deb | java-11-amazon-corretto-jdk_11.0.5.10-1_amd64.deb +# parts_pattern_fallback: >- +# {{ '(java-[\d\.]+-)?amazon-corretto-?(devel-1\.|jdk_|devel-)?' +# ~ '(\d+)\.[\d\.\-_b]*(-linux-|-windows-)?(amd64|x86_64|x64|arm64|aarch64)' +# ~ '\.(deb|rpm|tar\.gz|msi|zip)' }} + +# Special handling for RedHat like systems +# Downloaded RPM package name samples: +# java-1.8.0-amazon-corretto-devel-1.8.0_232.b09-1.x86_64.rpm | java-11-amazon-corretto-devel-11.0.5.10-1.x86_64.rpm +pattern_fallback_redhat: >- + {{ (ansible_os_family == 'RedHat') and (java_major_version|string == 11) + | ternary( + '^java-[0-9\.]+-amazon-corretto-devel-(11)\.([0-9\.\-]+)\.x86_64\.rpm', + '^java-[0-9\.]+-amazon-corretto-devel-1\.(8)\.0_([0-9b\.\-]+)\.x86_64\.rpm' + ) }} + +# Case #3. Install from downloaded tarball +# Parts are extracted from downloaded file name +# We're extracting only all parts except `java_package` +# File name sample: amazon-corretto-11.0.5.10.1-linux-x64.tar.gz +parts_pattern_web: '^(amazon-corretto)-([0-9]+)\.([0-9\.]+)-(linux|windows)-(x64)\.(tar\.gz|zip)' + +java_path: '{{ java_default_corretto_path }}' +java_folder: >- + {{ (not java_tarball_install | bool and (ansible_system == 'Linux')) + | ternary(java_folder_repo_transport, java_corretto_folder) }} + +# | ternary('java-1.' + java_major_version|string + '.0-amazon-corretto', +java_folder_repo_transport: >- + {{ (java_major_version|int == 8) + | ternary('java-1.' + java_major_version|string + '.0-amazon-corretto', + 'java-' + java_major_version|string + '-amazon-corretto') }} + +# Satisfy additional requirement for Amazon Corretto for Debian-based distributions +java_extra_package_requirements: >- + {{ ((ansible_os_family == 'Debian') and (transport == 'fallback')) + | ternary(['java-common'], []) }} diff --git a/vars/java_distro_configs/dragonwell8_vars.yml b/vars/java_distro_configs/dragonwell8_vars.yml index 10a3d82e..024fa73a 100644 --- a/vars/java_distro_configs/dragonwell8_vars.yml +++ b/vars/java_distro_configs/dragonwell8_vars.yml @@ -1,5 +1,11 @@ --- parts: >- - {{ java_artifact_basename + {{ java_artifact_basename | default('undefined', true) | regex_findall('^(Alibaba_Dragonwell)_(8)\.([0-9]\.[0-9])-GA_(Linux)_(x64)(\.tar\.gz)') - | first | list }} + | default([[]], true) | first | list }} + +java_package: jdk + +java_minor_version: '{{ parts[2] | default("*") }}' +java_os: '{{ parts[3] }}' +java_arch: '{{ parts[4] | default("x64") }}' diff --git a/vars/java_distro_configs/openjdk_vars.yml b/vars/java_distro_configs/openjdk_vars.yml index 5ba95d2b..2f713e96 100644 --- a/vars/java_distro_configs/openjdk_vars.yml +++ b/vars/java_distro_configs/openjdk_vars.yml @@ -1,8 +1,15 @@ --- +openjdk_root_page: https://jdk.java.net parts: >- - {{ java_artifact_basename + {{ java_artifact_basename | default('undefined', true) | regex_findall('^.*(j[dkre]{2})-([0-9]+)\.?([0-9.]+)?[-_]([a-z]+)-(x64|i586).*') - | first | list }} + | default([[]], true) | first | list }} + +jdk_package: '{{ jdk_package_openjdk }}' +java_package: '{{ parts[0] | default("jdk") }}' +java_minor_version: '{{ parts[2] | default("*") }}' +java_os: '{{ parts[3] }}' +java_arch: '{{ parts[4] | default("x64") }}' java_package_suffix: >- {{ (java_major_version == 11) | ternary(java_major_version, '') }} @@ -11,10 +18,29 @@ choco_java_package: 'openjdk{{ java_package_suffix }}' choco_path: 'C:\Program Files\OpenJDK' +# Variables for RHEL specific (example java-11-openjdk-devel.x86_64) +# Define Centos arch specific for compatibility with oracle packages name +openjdk_arch_rhel: '{{ (java_arch == "x64") | ternary("x86_64", "i686") }}' +# java-11-openjdk.x86_64 is OpenJDK Runtime Environment +# java-11-openjdk-devel.x86_64 : OpenJDK Development Environment 11 +# change variables for more compatibility jdk/jre +openjdk_package_rhel_spec: >- + {{ (java_package == 'jdk') + | ternary('openjdk-devel.' + openjdk_arch_rhel, + 'openjdk.' + openjdk_arch_rhel) + }} +# change java_major_version (if it 8) for rhel specific 1.8.0 +openjdk_package_rhel_versions: >- + {{ (java_major_version|int <= 8) + | ternary('1.' + java_major_version|string + '.0', + java_major_version|string) + }} + java_folder_ext_transport: >- {{ ((java_minor_version | default('') | string).find('*') != -1) | ternary(java_package + '-' + java_major_version|string, java_def_folder_ext_transport) }} java_folder: >- - {{ (not java_tarball_install | bool and (ansible_system == 'Linux')) | ternary(java_folder_repo_transport, java_folder_ext_transport) }} + {{ (not java_tarball_install | bool and (ansible_system == 'Linux')) + | ternary(java_folder_repo_transport, java_folder_ext_transport) }} diff --git a/vars/java_distro_configs/oracle_java_vars.yml b/vars/java_distro_configs/oracle_java_vars.yml index 7966ab25..ecee83fa 100644 --- a/vars/java_distro_configs/oracle_java_vars.yml +++ b/vars/java_distro_configs/oracle_java_vars.yml @@ -1,5 +1,32 @@ --- +# Urls for java security policy +fallback_oracle_security_policy_artifacts: + 6: http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip + 7: http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip + 8: http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip + +# patch archive subfolder +security_patch_folders: + 6: jce + 7: UnlimitedJCEPolicy + 8: UnlimitedJCEPolicyJDK8 + +# security policy path +security_patch_path: >- + {{ (java_package|string == 'jdk') + | ternary(java_path + '/' + java_folder + '/jre/lib/security', + java_path + '/' + java_folder + '/lib/security') + }} + parts: >- {{ java_artifact_basename | regex_findall('^.*(j[dkre]{2})-([0-9]+)[u.]([0-9.]+)[-_]([a-z]+)-(x64|i586)') | first | list }} + +java_package: >- + {{ parts[0] | default('jdk') }} +java_major_version: '{{ parts[1] }}' +java_minor_version: '{{ parts[2] }}' +java_os: '{{ parts[3] }}' +java_arch: >- + {{ parts[4] | default('x64') }} diff --git a/vars/java_distro_configs/sapjvm_vars.yml b/vars/java_distro_configs/sapjvm_vars.yml index 562c85bc..787b476f 100644 --- a/vars/java_distro_configs/sapjvm_vars.yml +++ b/vars/java_distro_configs/sapjvm_vars.yml @@ -1,5 +1,13 @@ --- +sapjvm_root_page: https://tools.hana.ondemand.com parts: >- - {{ java_artifact_basename + {{ java_artifact_basename | default('undefined', true) | regex_findall('^(sapjvm)-([0-9]+)[u.]([0-9.]+)[-_]([a-z]+)-(x64|i586)') - | first | list }} + | default([[]], true) | first | list }} + +java_package: >- + {{ parts[0] | default("jdk") }} + +java_minor_version: '{{ parts[2] }}' +java_os: '{{ parts[3] }}' +java_arch: '{{ parts[4] | default("x64") }}' diff --git a/vars/java_distro_configs/sapmachine_vars.yml b/vars/java_distro_configs/sapmachine_vars.yml index c5437068..dbf4d58d 100644 --- a/vars/java_distro_configs/sapmachine_vars.yml +++ b/vars/java_distro_configs/sapmachine_vars.yml @@ -1,20 +1,31 @@ --- +sapmachine_root_page: https://github.com/SAP/SapMachine/releases/download/ +sapmachine_api_page: https://api.github.com/repos/SAP/SapMachine/releases/tags/ + +java_sapmachine_release_page: >- + {{ sapmachine_api_page|string + java_distribution|string + '-' + + (java_minor_version == '*') | ternary(release_version|default ('')|string, + java_major_version|string + '.' + java_minor_version|string) }} + +java_sapmachine_release_name: >- + {{ java_distribution|string + '-' + java_package|string + '-' + + (java_minor_version == '*') | ternary(release_version|default ('')|string, java_major_version|string + '.' + java_minor_version|string) + + '_' + (ansible_system == 'Win32NT') | ternary('windows', ansible_system|lower ) + '-' + java_arch|string + '_bin' }} + parts: >- - {{ java_artifact_basename + {{ java_artifact_basename | default('undefined', true) | regex_findall('^.*(j[dkre]{2})-([0-9]+)\.?([0-9.]+)?[-_]([a-z]+)-(x64|i586).*') - | first | list }} + | default([[]], true) | first | list }} -choco_java_package: 'sapmachine{{ java_major_version }}' +java_package: >- + {{ parts[0] | default('jdk') }} -choco_path: 'C:\Program Files\SapMachine' +java_minor_version: '{{ parts[2] | default("*") }}' +java_os: '{{ parts[3] }}' +java_arch: '{{ parts[4] | default("x64") }}' -java_folder: '{{ java_major_version }}' +choco_java_package: 'sapmachine{{ java_major_version }}' -release_page: >- - {{ sapmachine_api_page|string + java_distribution|string + '-' - + (java_minor_version == '*') | ternary(release_version|default ('')|string, java_major_version|string + '.' + java_minor_version|string) }} +choco_path: 'C:\Program Files\SapMachine' -release_name: >- - {{ java_distribution|string + '-' + java_package|string + '-' - + (java_minor_version == '*') | ternary(release_version|default ('')|string, java_major_version|string + '.' + java_minor_version|string) - + '_' + (ansible_system == 'Win32NT') | ternary('windows', ansible_system|lower ) + '-' + java_arch|string + '_bin' }} +java_folder: '{{ java_package }}' diff --git a/vars/java_distro_configs/zulu_vars.yml b/vars/java_distro_configs/zulu_vars.yml index d0ed6bec..6e4938cb 100644 --- a/vars/java_distro_configs/zulu_vars.yml +++ b/vars/java_distro_configs/zulu_vars.yml @@ -1,10 +1,16 @@ --- +zulu_api_page: https://zulu.api.azul.com/api/v1/ parts: >- - {{ java_artifact_basename + {{ java_artifact_basename | default('undefined', true) | regex_findall('^(zulu)([0-9]+)\.([0-9.]+)-.+-([a-z]+)[_.](x64|i686|amd64|x86_64)') - | first | list }} + | default([[]], true) | first | list }} -checksum_alg: md5 +java_package: >- + {{ parts[0] | default('jdk') }} + +java_minor_version: '{{ parts[2] | default("*") }}' +java_os: '{{ parts[3] }}' +java_arch: '{{ parts[4] | default("x64") }}' choco_java_package: 'zulu{{ java_major_version }}' @@ -14,6 +20,9 @@ java_folder_repo_transport: >- choco_path: 'C:\Program Files\Zulu' +zulu_folder_ext_transport: >- + {{ (transport == 'chocolatey') | ternary('', java_folder_ext_transport) }} + zulu_folder: >- {{ (transport == 'chocolatey') | ternary('zulu-' + java_major_version|string, java_folder_ext_transport) }} diff --git a/vars/java_parts.yml b/vars/java_parts.yml index 8dcbff7d..80b64886 100644 --- a/vars/java_parts.yml +++ b/vars/java_parts.yml @@ -1,5 +1,7 @@ --- -java_package: '{{ (java_distribution == "dragonwell8") | ternary("jdk", parts[0]) | default("jdk") }}' +java_package: >- + {{ ((java_distribution == "dragonwell8") or (java_distribution == "corretto")) + | ternary("jdk", parts[0]) | default("jdk") }} java_major_version: '{{ (java_distribution == "adoptopenjdk") | ternary(parts[4], parts[1]) }}' java_minor_version: '{{ (java_distribution == "adoptopenjdk") | ternary(parts[5], parts[2]) }}' java_os: '{{ parts[3] }}' diff --git a/vars/main.yml b/vars/main.yml index 1bffab3a..256071ae 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,48 +1,28 @@ --- -openjdk_root_page: https://jdk.java.net -sapjvm_root_page: https://tools.hana.ondemand.com -adoptopenjdk_api_page: https://api.adoptopenjdk.net/v2/ -zulu_api_page: https://zulu.api.azul.com/api/v1/ -sapmachine_root_page: https://github.com/SAP/SapMachine/releases/download/ github_api_page: https://api.github.com -sapmachine_api_page: https://api.github.com/repos/SAP/SapMachine/releases/tags/ # vars file for java transport_web_default: https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz java_download_default_path: /tmp -java_artifact: '{{ (file_downloaded|default({})).dest | default(omit) }}' -java_artifact_basename: '{{ java_artifact | basename }}' +java_artifact: '{{ (file_downloaded|default({})).dest | default("", true) }}' +java_artifact_basename: '{{ java_artifact | basename | default("", true) }}' +jdk_package: '' java_full_version: >- {{ ( java_minor_version | default('') | string | length ) | ternary(java_major_version ~ '.' ~ java_minor_version, java_major_version) }} -# Urls for java security policy -fallback_oracle_security_policy_artifacts: - 6: http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip - 7: http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip - 8: http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip - -# patch archive subfolder -security_patch_folders: - 6: jce - 7: UnlimitedJCEPolicy - 8: UnlimitedJCEPolicyJDK8 - -# security policy path -security_patch_path: >- - {{ (java_package|string == 'jdk') - | ternary(java_path + '/' + java_folder + '/jre/lib/security', - java_path + '/' + java_folder + '/lib/security') - }} - -java_folder_ext_transport: '{{ java_def_folder_ext_transport }}' - java_def_folder_ext_transport: >- {{ (java_major_version|int <= 8) | ternary(java_package + '1.' + java_major_version|string + '.0_' + java_minor_version|string, java_package + '-' + java_full_version|string) }} +java_folder_ext_transport: '{{ java_def_folder_ext_transport }}' + java_folder: '{{ java_folder_ext_transport }}' + +# Override the value of the variable in java_distro_configs +# for specific java distribution if needed +java_extra_package_requirements: []