Skip to content

Commit 64590bb

Browse files
Feature/add corretto (#108)
* 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]>
1 parent 8b0d4ea commit 64590bb

File tree

90 files changed

+1604
-732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1604
-732
lines changed

.gitlab-ci.yml

Lines changed: 281 additions & 261 deletions
Large diffs are not rendered by default.

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2+
os: linux
23
dist: bionic
3-
sudo: required
44

55
language: python
66
python:
7-
- "3.7"
7+
- "3.8"
88

99
services:
1010
- docker
@@ -13,7 +13,7 @@ before_install:
1313
- git clone https://github.com/lean-delivery/ansible-lint-rules.git ~/ansible-lint-rules
1414

1515
install:
16-
- pip3 install --upgrade ansible==2.8.* docker molecule==2.22
16+
- pip3 install --upgrade ansible==2.9.* docker molecule==2.22
1717
- pip3 install git+https://github.com/ansible/ansible-lint.git
1818
- ansible --version
1919
- ansible-lint --version

README.md

Lines changed: 101 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ This Ansible role has the following features for:
2020
- Install JRE, JDK, Server-JRE
2121
- Additional opportunity to install from s3, web, local source.
2222

23+
**DISCLAIMER**: usage of any version of this role implies you have accepted the
24+
[Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html).
25+
2326
**SAPJVM**
2427

2528
- Install JDK
@@ -48,8 +51,11 @@ This Ansible role has the following features for:
4851
- Linux/x86_64 platform only
4952
- Additional opportunity to install from dragonwell8-fallback, web, local source, s3.
5053

51-
DISCLAIMER: usage of any version of this role implies you have accepted the
52-
[Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html).
54+
**Amazon Corretto**
55+
56+
- Install JDK 8 and 11
57+
- Install JRE 8 (Amazon Linux 2 only)
58+
- Additional opportunity to install from fallback, web, local source, s3.
5359

5460

5561
Requirements
@@ -78,12 +84,12 @@ Requirements
7884
- Debian stretch: tarball
7985
- Windows: tarball
8086
- 13
81-
- EL 6: tarball, openjdk-fallback
82-
- EL 7: tarball, openjdk-fallback
83-
- EL 8: tarball, openjdk-fallback
84-
- Ubuntu bionic: tarball, openjdk-fallback
85-
- Debian stretch: tarball, openjdk-fallback
86-
- Windows: tarball, openjdk-fallback
87+
- EL 6: tarball, fallback
88+
- EL 7: tarball, fallback
89+
- EL 8: tarball, fallback
90+
- Ubuntu bionic: tarball, fallback
91+
- Debian stretch: tarball, fallback
92+
- Windows: tarball, fallback
8793
- **Supported oracle java version**:
8894
- 7
8995
- 8
@@ -104,41 +110,47 @@ Requirements
104110
- 13
105111
- **Supported SapMachine version**:
106112
- 11
107-
- EL 7: sapmachine-fallback
108-
- EL 8: sapmachine-fallback
109-
- Ubuntu bionic: sapmachine-fallback
110-
- Debian stretch: sapmachine-fallback
111-
- Windows: chocolatey (only latest version, don't support java_minor_version variables), sapmachine-fallback
113+
- EL 7: fallback
114+
- EL 8: fallback
115+
- Ubuntu bionic: fallback
116+
- Debian stretch: fallback
117+
- Windows: chocolatey (only latest version, don't support java_minor_version variables), fallback
112118
- 12
113119
- EL 7: tarball
114120
- EL 8: tarball
115121
- Ubuntu bionic: tarball
116122
- Debian stretch: tarball
117123
- Windows: tarball
118124
- 13
119-
- EL 7: sapmachine-fallback
120-
- EL 8: sapmachine-fallback
121-
- Ubuntu bionic: sapmachine-fallback
122-
- Debian stretch: sapmachine-fallback
123-
- Windows: chocolatey (only latest version, don't support java_minor_version variables), sapmachine-fallback
125+
- EL 7: fallback
126+
- EL 8: fallback
127+
- Ubuntu bionic: fallback
128+
- Debian stretch: fallback
129+
- Windows: chocolatey (only latest version, don't support java_minor_version variables), fallback
124130
- **Supported Alibaba Dragonwell version**:
125131
- 8.0.0
126132
- 8.1.1
133+
- **Supported Amazon Corretto version**:
134+
- 8
135+
- 11
127136
- **Supported OS**:
128137
- Ubuntu
129138
- bionic
130139
- xenial
131140
- trusty
132141
- Debian
133142
- stretch
143+
- buster
134144
- Amazon Linux
135145
- Amazon Linux 2
136-
- EL
146+
- EL (RHEL/CentOS)
137147
- 6
138148
- 7
139149
- 8
140150
- Windows
141-
- all
151+
- 10
152+
- 2016
153+
- 2019
142154

143155
## Role Variables
144156
- `java_distribution` Java distribution type, one of:
@@ -149,6 +161,7 @@ Requirements
149161
- `adoptopenjdk`
150162
- `sapmachine`
151163
- `dragonwell8`
164+
- `corretto`
152165

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

@@ -158,21 +171,16 @@ Requirements
158171
- `jdk` (default)
159172
- `jre`
160173

161-
- `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.
174+
- `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.
162175

163176
Available:
164-
- `repositories` Installing OpenJDK java from system repositories (yum or apt, Linux only)
177+
- `repositories` Installing java from system repositories (yum or apt, Linux only)
165178
- `web` Fetching artifact from custom web url
166-
- `chocolatey` Windows specific package manager (Supported OpenJDK: JDK 11,12 or JRE 8)
179+
- `chocolatey` Windows specific package manager (Supported OpenJDK: JDK 11, 12 or JRE 8, SapMachine, ZULU, AdoptOpenJDK)
167180
- `local` Local artifact stored on ansible master (can be used as cache for other transport)
168181
- `s3` Download artifact from s3 bucket (Linux clients only, for Windows please use other transports)
169-
- `sapjvm-fallback` fetching artifact from SAP site.
170-
- `zulu-fallback` fetching artifact from AZUL site.
171-
- `adoptopenjdk-fallback` fetching artifact from adoptopenjdk site.
172-
- `sapmachine-fallback` fetching artifact from SapMachine site.
173-
- `dragonwell8-fallback` fetching artifact from GitHub.
174-
- `openjdk-fallback` fetching artifact from jdk.java.net.
175-
This is default value for `transport` variable
182+
- `fallback` fetching artifacts from official sites (available for distributions: openjdk, sapjvm, zulu, adoptopenjdk, sapmachine, dragonwell8, corretto).
183+
This is *default* value for `transport` variable
176184

177185
**Notice** using `s3` transport requires specific packages to be installed on target host:
178186
- 'botocore'
@@ -225,11 +233,18 @@ Requirements
225233
- `hotspot` (default)
226234
- `openj9`
227235

236+
# Configure executable paths
237+
238+
- `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.
239+
default: `true`
240+
228241
# Configure unlimited policy
242+
229243
- `java_unlimited_policy_enabled` - to apply unlimited policy
230244

231245
default: `false`
232-
- `java_unlimited_policy_transport` Artifact source transport. Use `local`, `web` or `s3` for more predictable result.
246+
- `java_unlimited_policy_transport` Artifact source transport. Use `fallback`, `local`, `web` or `s3` for more predictable result.
247+
defaule: `fallback`
233248

234249
Available:
235250
- `web` Fetching artifact from custom web url
@@ -251,6 +266,7 @@ ansible-galaxy install lean_delivery.java
251266
Example Playbook
252267
----------------
253268
### Installing OpenJDK 13 from openjdk-fallback (default role behaviour):
269+
254270
```yaml
255271
- name: Install openjdk java
256272
hosts: all
@@ -260,6 +276,7 @@ Example Playbook
260276
```
261277
262278
### Installing OpenJDK 8 from repositories:
279+
263280
```yaml
264281
- name: Install openjdk java
265282
hosts: all
@@ -271,6 +288,7 @@ Example Playbook
271288
```
272289
273290
### Installing OpenJDK 11 from web:
291+
274292
```yaml
275293
- name: Install openjdk java
276294
hosts: all
@@ -284,6 +302,7 @@ Example Playbook
284302
```
285303
286304
### Installing Oracle java 8 from local file:
305+
287306
```yaml
288307
- name: Install oracle java
289308
hosts: all
@@ -297,6 +316,7 @@ Example Playbook
297316
### Installing Oracle java 8 from S3 bucket:
298317
Before install you should prepare host to use aws_s3 module
299318
https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements
319+
300320
```yaml
301321
- name: Install java
302322
hosts: all
@@ -312,6 +332,7 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements
312332

313333
```
314334
### Installing OpenJDK 11.0.2 on Windows host with win_chocolatey:
335+
315336
```yaml
316337
- name: Install java
317338
hosts: windows
@@ -324,63 +345,107 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements
324345
java_minor_version: 0.2
325346
```
326347
### Installing SAPJVM 8 from sapjvm-fallback:
348+
327349
```yaml
328350
- name: Install sapjvm
329351
hosts: all
330352

331353
roles:
332354
- role: lean_delivery.java
333355
java_distribution: sapjvm
334-
transport: sapjvm-fallback
356+
transport: fallback
335357
java_major_version: 8
336358
```
337359
### Installing ZULU 12 from zulu-fallback:
360+
338361
```yaml
339362
- name: Install zulu
340363
hosts: all
341364

342365
roles:
343366
- role: lean_delivery.java
344367
java_distribution: zulu
345-
transport: zulu-fallback
368+
transport: fallback
346369
```
347370
### Installing AdoptOpenJDK 8-openj9-jre from adoptopenjdk-fallback:
371+
348372
```yaml
349373
- name: Install AdoptOpenJDK
350374
hosts: all
351375

352376
roles:
353377
- role: lean_delivery.java
354378
java_distribution: adoptopenjdk
355-
transport: adoptopenjdk-fallback
379+
transport: fallback
356380
java_package: jre
357381
adoptopenjdk_impl: openj9
358382
java_major_version: 8
359383
```
360384
361385
### Installing SapMachine sapmachine-jre-10 from sapmachine-fallback:
386+
362387
```yaml
363388
- name: Install SapMachine
364389
hosts: all
365390

366391
roles:
367392
- role: lean_delivery.java
368393
java_distribution: sapmachine
369-
transport: sapmachine-fallback
394+
transport: fallback
370395
java_package: jre
371396
java_major_version: 10
372397
```
373398
### Installing Alibaba Dragonwell 8 from dragonwell8-fallback:
399+
374400
```yaml
375401
- name: Install Alibaba Dragonwell8
376402
hosts: all
377403

378404
roles:
379405
- role: lean_delivery.java
380406
java_distribution: dragonwell8
381-
transport: dragonwell8-fallback
407+
transport: fallback
408+
java_major_version: 8
409+
```
410+
### Installing Amazon Corretto JDK 8 from corretto-fallback:
411+
412+
```yaml
413+
- name: Install Amazon Corretto
414+
hosts: all
415+
416+
roles:
417+
- role: lean_delivery.java
418+
java_distribution: corretto
419+
transport: fallback
382420
java_major_version: 8
383421
```
422+
423+
### Installing Amazon Corretto JDK 11 from repo on Amazon Linux 2:
424+
425+
```yaml
426+
- name: Install Amazon Corretto
427+
hosts: all
428+
429+
roles:
430+
- role: lean_delivery.java
431+
java_distribution: corretto
432+
transport: repositories
433+
java_major_version: 11
434+
```
435+
436+
### Installing Amazon Corretto JDK 11 on Ubuntu 18.04 from web:
437+
438+
```yaml
439+
- name: Install Amazon Corretto
440+
hosts: all
441+
442+
roles:
443+
- role: lean_delivery.java
444+
java_distribution: corretto
445+
transport: web
446+
transport_web: https://d3pxv6yz143wms.cloudfront.net/11.0.5.10.1/amazon-corretto-11.0.5.10.1-linux-x64.tar.gz
447+
```
448+
384449
License
385450
-------
386451

defaults/main.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
# - adoptopenjdk (not supported 9/10)
88
# - alibaba_dragonwell (8 only)
99
# - sapmachine
10+
# - Amazon Corretto (supported only 8/11)
1011
java_distribution: openjdk
1112

1213
# OpenJDK tarball supported only jdk
1314
# Oracle java supported jre/server-jre/jdk
1415
# AdoptOpenJDK supported jdk/jre
1516
# SapMachine supported jdk/jre
1617
# Alibaba Dragonwell supported jdk only
18+
# Amazon Corretto 8 supported jdk/jre, jre only for Windows and Amazon Linux2
19+
# Amazon Corretto 11 supported only jdk
1720
java_package: jdk
1821

1922
# AdoptOpenJDK Implementation (hotspot/openj9)
@@ -37,9 +40,11 @@ java_path: "{{ (transport == 'repositories') | ternary('/usr/lib/jvm', java_defa
3740
java_download_path: '{{ java_download_default_path }}'
3841

3942
# Custom artifact source transport
40-
java_tarball_install: "{{ transport != 'repositories' }}"
41-
java_binary_type: "{{ java_tarball_install | ternary('tarball', 'package') }}"
42-
transport: openjdk-fallback
43+
java_tarball_install: >-
44+
{{ transport != 'repositories' }}
45+
java_binary_type: >-
46+
{{ java_tarball_install | ternary('tarball', 'package') }}
47+
transport: fallback
4348
# available are:
4449
# - "web" Fetching artifact from custom web uri (not supporting idempotent operation)
4550
# - "s3" Fetching artifact from s3 bucket
@@ -52,6 +57,7 @@ transport: openjdk-fallback
5257
# - "zulu-fallback" Install from artifact downloaded from AZUL site
5358
# - "sapmachine-fallback" Install from artifact downloaded from SapMachine site
5459
# - "dragonwell-fallback" Install from artifact downloaded from GitHub site
60+
# - "corretto-fallback" Install from artifact downloaded from AWS Amazon site
5561

5662
transport_web: '{{ transport_web_default }}'
5763
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
6167
transport_s3_aws_access_key: "{{ lookup('env','AWS_ACCESS_KEY') }}"
6268
transport_s3_aws_secret_key: "{{ lookup('env','AWS_SECRET_KEY') }}"
6369

70+
java_setup_path: true
71+
6472
# Configure unlimited security policy
6573
java_unlimited_policy_enabled: false
6674
# For Java earlier than 1.8.0_151

0 commit comments

Comments
 (0)