Skip to content

Commit

Permalink
Feature/add corretto (#108)
Browse files Browse the repository at this point in the history
* EPMLDI-1739: add basic corretto fallback implementation

* EPMLDI-1739: to fix Corretto 11 later

* EPMLDI-1739: add install from repo to Amazon Linux 2

* EPMLDI-1739: corrections according to yamllint hints

* EPMLDI-1739: adjust install from repo to Amazon Linux 2

* EPMLDI-1739: fix install from repo to Amazon Linux 2

* EPMLDI-1739: re-use basic task

* EPMLDI-1739: check requested version

* EPMLDI-1739: refactor impl, support two cases - install from downloaded package or from repo o Amazon Linux 2

* EPMLDI-1739: refactor impl, remove task because of duplication of logic

* EPMLDI-1739: add install from tarball

* EPMLDI-1739: add molecule tests for corretto Linux

* EPMLDI-1739: add molecule tests for corretto Linux to gitlab-ci

* EPMLDI-1739: temporary disable all molecule tests except corretto

* EPMLDI-1739: update readme file with Amazon Corretto for Linux

* EPMLDI-1739: fixes according to ansible lint recommendations

* EPMLDI-1739: fixes according to ansible lint recommendations

* EPMLDI-1739: fix logic for fallback transport: downloaded rpm/deb files must be installed as package

* EPMLDI-1739: fix syntax according to ansible lint recommendations

* EPMLDI-1739: fix bug

* EPMLDI-1739: delete unneeded check

* EPMLDI-1739: rename to clarify installation option

* EPMLDI-1739: rename tests to clarify transport

* EPMLDI-1739: add clarification

* EPMLDI-1739: refactor corretto-fallback install from package

* EPMLDI-1739: remove info about Windows support until it is supported

* EPMLDI-1739: fix bug with missing group property

* EPMLDI-1739: add new line to the end of file according to ansible lint rules

* EPMLDI-1739: omit amazon-linux-extras command usage in Ansible

* EPMLDI-1739: extend readme - add amazon corretto install samples

* EPMLDI-1739: fix syntax after merge conflict resolving

* EPMLDI-1739: temporary disable test because of bug

* EPMLDI-1739: fix bug that occurred while disabling the test

* EPMLDI-1739: refactor corretto8 installation on Amazon Linux 2 according to Timur's advice

* EPMLDI-1739: refactor corretto-fallback installation according to Timur's advice

* EPMLDI-1739: temporary disable all other test to test corretto only

* EPMLDI-1739: refactor corretto8 installation on Amazon Linux 2 according to Timur's advice

* EPMLDI-1739: try to eliminate Ansible bug with dynamic variable evaluation

* EPMLDI-1739: try to avoid Ansible bug with dynamic variable evaluation

* Revert "EPMLDI-1739: try to avoid Ansible bug with dynamic variable evaluation"

* Revert "EPMLDI-1739: try to eliminate Ansible bug with dynamic variable evaluation"

* EPMLDI-1739: introduce additional internal variable to satisfy specific java distribution requirements

* EPMLDI-1739: fix syntax according to ansible lint recommendations

* EPMLDI-1739: fix syntax according to ansible lint recommendations

* EPMLDI-1739: add extra package only for Debian like systems

* EPMLDI-1739: fix syntax according to ansible lint recommendations

* EPMLDI-1739: fix logic to eliminate bug

* EPMLDI-1739: fix URL to new Amazon AWS UI

* EPMLDI-1739: add some detail to fallback implementation

* EPMLDI-1739: refactor to fix issue with missing jdk_package value in case of corretto-fallback

* EPMLDI-1739: support installation via web transport

* EPMLDI-1739: add one more playbook sample for Corretto

* EPMLDI-1739: fix regex pattern to capture proper java_major_version part from downloaded package of Corretto 8

* Correct parsing regex

* Test corretto fallback

* Fix security fetch

* Fix java_unlimited_policy_transport

* Update Readme

* Ref/vars (#111)

* Move vars to begin

* Optimize vars & fetch

* Update travis.ci

Signed-off-by: Timur Gadiev <[email protected]>
  • Loading branch information
dzmitryastrouski authored Mar 1, 2020
1 parent 8b0d4ea commit 64590bb
Show file tree
Hide file tree
Showing 90 changed files with 1,604 additions and 732 deletions.
542 changes: 281 additions & 261 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
os: linux
dist: bionic
sudo: required

language: python
python:
- "3.7"
- "3.8"

services:
- docker
Expand All @@ -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
Expand Down
137 changes: 101 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -104,41 +110,47 @@ 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
- Ubuntu bionic: tarball
- 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
- xenial
- 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:
Expand All @@ -149,6 +161,7 @@ Requirements
- `adoptopenjdk`
- `sapmachine`
- `dragonwell8`
- `corretto`

**Notice**: this variable is mandatory in case of installing other distribution than 'openjdk'.

Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -260,6 +276,7 @@ Example Playbook
```
### Installing OpenJDK 8 from repositories:
```yaml
- name: Install openjdk java
hosts: all
Expand All @@ -271,6 +288,7 @@ Example Playbook
```
### Installing OpenJDK 11 from web:
```yaml
- name: Install openjdk java
hosts: all
Expand All @@ -284,6 +302,7 @@ Example Playbook
```
### Installing Oracle java 8 from local file:
```yaml
- name: Install oracle java
hosts: all
Expand 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
Expand 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
Expand All @@ -324,63 +345,107 @@ 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

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

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

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

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

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
-------
Expand Down
14 changes: 11 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
# - adoptopenjdk (not supported 9/10)
# - alibaba_dragonwell (8 only)
# - sapmachine
# - Amazon Corretto (supported only 8/11)
java_distribution: openjdk

# OpenJDK tarball supported only jdk
# Oracle java supported jre/server-jre/jdk
# 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)
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down
Loading

0 comments on commit 64590bb

Please sign in to comment.