Skip to content

Commit

Permalink
Add SapMachine: EPMLDI-1738 (#97) (#98)
Browse files Browse the repository at this point in the history
* Add SapMachine (Linux): EPMLDI-1738 (#97)

* fix tests: EPMLDI-1738 (#97)

* fix s3: EPMLDI-1738 (#97)

* add win: EPMLDI-1738 (#97)

* fix verison: EPMLDI-1738 (#97)

*  fix tag for gitlab-ci: EPMLDI-1738 (#97)
  • Loading branch information
y6vmeq authored and tgadiev committed Oct 21, 2019
1 parent 38ebbb5 commit f378136
Show file tree
Hide file tree
Showing 22 changed files with 1,111 additions and 19 deletions.
45 changes: 45 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,48 @@ AWS adoptopenjdk Windows:
- molecule test -s cloud-aws-adoptopenjdk-windows
tags:
- aws

AWS sapmachine-10:
variables:
AWS_REGION: us-east-1
stage: deployment test
script:
- molecule test -s cloud-aws-sapmachine-10
tags:
- aws

AWS sapmachine-11:
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

AWS sapmachine-13:
variables:
AWS_REGION: us-east-1
stage: deployment test
script:
- molecule test -s cloud-aws-sapmachine-13
tags:
- aws

AWS sapmachine-windows:
variables:
AWS_REGION: us-east-1
stage: deployment test
script:
- molecule test -s cloud-aws-sapmachine-windows
tags:
- aws
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ This Ansible role has the following features for:
- Install JDK, JRE
- Additional opportunity to install from adoptopenjdk-fallback, repositories, web, local source, s3, chocolatey.


**SapMachine**

- Install JDK, JRE
- Additional opportunity to install from sapmachine-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).

Expand Down Expand Up @@ -89,6 +95,11 @@ Requirements
- 11
- 12
- 13
- **Supported SapMachine version**:
- 10
- 11
- 12
- 13
- **Supported OS**:
- Ubuntu
- bionic
Expand All @@ -112,6 +123,7 @@ Requirements
- `sapjvm`
- `zulu`
- `adoptopenjdk`
- `sapmachine`

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

Expand All @@ -121,7 +133,7 @@ Requirements
- `jdk` (default)
- `jre`

- `transport` Artifact source transport. Use `openjdk-fallback`(OpenJDK only), `repositories`(OpenJDK only), `sapjvm-fallback`(SAPJVM only), `adoptopenjdk-fallback`(AdoptOpenJDK only), `zulu-fallback`(ZULU only), `local`, `web` or `s3` for more predictable result.
- `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), `local`, `web` or `s3` for more predictable result.

Available:
- `repositories` Installing OpenJDK java from system repositories (yum or apt, Linux only)
Expand All @@ -132,6 +144,7 @@ Requirements
- `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.
- `openjdk-fallback` fetching artifact from jdk.java.net.
This is default value for `transport` variable

Expand Down Expand Up @@ -318,6 +331,18 @@ https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements
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
java_package: jre
java_major_version: 10
```
License
-------
Expand Down
5 changes: 4 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
# - sapjvm
# - zulu
# - adoptopenjdk (not supported 9/10)
# - sapmachine (suported only 10/11/12/13)
java_distribution: openjdk

# OpenJDK tarball supported only jdk
# Oracle java supported jre/server-jre/jdk
# AdoptOpenJDK supported jdk/jre
# SapMachine supported jdk/jre
java_package: jdk

# AdoptOpenJDK Implementation (hotspot/openj9)
adoptopenjdk_impl: hotspot

# OpenJDK Redhat: 8 (packages) / 11 (package for centos7, tarball for all other) / 12 (tarball)
# OpenJDK Redhat: 8 (packages) / 11 (package for centos7, tarball for all other) / 12 (tarball)
# OpenJDK Debian: 8 (packages) / 11 (package for ubuntu18, tarball for all other) / 12 (tarball)
# Oracle java: 8 (jre/server-jre/jdk) / 11 (jdk)
java_major_version: 12
Expand Down Expand Up @@ -46,6 +48,7 @@ transport: openjdk-fallback
# - "adoptopenjdk-fallback" Install from artifact downloaded from adoptopenjdk site
# - "sapjvm-fallback" Install from artifact downloaded from SAP site
# - "zulu-fallback" Install from artifact downloaded from AZUL site
# - "sapmachine-fallback" Install from artifact downloaded from SapMachine site

transport_web: '{{ transport_web_default }}'
transport_local: "/tmp/openjdk-11.0.2_linux-x64_bin.tar.gz"
Expand Down
17 changes: 0 additions & 17 deletions molecule/cloud-aws-adoptopenjdk-12/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,3 @@
register: status
until: status is succeeded
become: true

- name: Prepare host to S3 transport
hosts: localhost
vars:
transport_s3_bucket: java-molecule-s3-test
transport_s3_path: /java/adoptopenjdk/OpenJDK12U-jdk_x64_linux_hotspot_12.0.1_12.tar.gz
java_download_path: /tmp
tasks:
- name: Download artifact from s3
aws_s3:
bucket: '{{ transport_s3_bucket }}'
object: '{{ transport_s3_path }}'
dest: '{{ java_download_path }}/{{ transport_s3_path | basename }}'
mode: get
overwrite: different
retries: 5
delay: 2
138 changes: 138 additions & 0 deletions molecule/cloud-aws-sapmachine-10/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
driver:
name: ec2
lint:
name: yamllint
options:
config-file: .yamllint
platforms:
- name: test-aws-centos7-sapmachine-jdk-tarball-10
image: ami-9887c6e7
platform: centos7
instance_type: m5.large
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
- sapmachine
- jdk
- sapmachine_fallback

- name: test-aws-centos8-sapmachine-jre-tarball-10
image: ami-0ed2ad9dc845b42b6
platform: centos8
instance_type: m5.large
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
- sapmachine
- jre
- sapmachine_fallback

- name: test-aws-Debian9-sapmachine-jre-tarball-10
image: ami-003f19e0e687de1cd
platform: debian9
instance_type: m5.large
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
- sapmachine
- jre
- sapmachine_fallback

- name: test-aws-ubuntu18-sapmachine-jdk-tarball-10
image: ami-012fd5eb46f56731f
platform: ubuntu18
instance_type: m5.large
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
- sapmachine
- jdk
- sapmachine_fallback

- name: test-aws-ubuntu18-sapmachine-s3-10
image: ami-012fd5eb46f56731f
profile_name: epmldi-instance-profile
platform: ubuntu18
instance_type: m5.large
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
- sapmachine
- s3

provisioner:
name: ansible
log: false
config_options:
defaults:
callback_whitelist: profile_tasks,timer
inventory:
group_vars:
sapmachine:
java_distribution: sapmachine
java_major_version: 10
jdk:
java_package: jdk
jre:
java_package: jre
sapmachine_fallback:
transport: sapmachine-fallback
s3:
transport: s3
transport_s3_bucket: java-molecule-s3-test
transport_s3_path: /java/sapmachine/sapmachine-jdk-10.0.2.13_linux-x64_bin.tar.gz
transport_s3_aws_access_key: "{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
transport_s3_aws_secret_key: "{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
playbooks:
create: ../resources/provisioning/AWS/create.yml
prepare: ../cloud-aws-sapmachine-10/prepare.yml
destroy: ../resources/provisioning/AWS/destroy.yml
verify: ../resources/tests/verify.yml
lint:
name: ansible-lint
scenario:
name: cloud-aws-sapmachine-10
verifier:
name: ansible
lint:
name: ansible-lint
5 changes: 5 additions & 0 deletions molecule/cloud-aws-sapmachine-10/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: ansible-role-java
61 changes: 61 additions & 0 deletions molecule/cloud-aws-sapmachine-10/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
- 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
state: present
when: ansible_distribution_release == 'bionic'
become: true

- name: Install python packages
apt:
name:
- python-setuptools
state: present
register: status
until: status is succeeded
become: true

- 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
until: status is succeeded
become: true

- name: Prepare host to S3 transport
hosts: s3
tasks:

- name: Install pip package
package:
name: 'python-pip'
state: present
register: status
until: status is succeeded
become: true

- name: Install boto module
pip:
name:
- botocore
- boto
- boto3
state: present
executable: 'pip'
extra_args: --upgrade
register: status
until: status is succeeded
become: true
Loading

0 comments on commit f378136

Please sign in to comment.