This Ansible role has the following features for:
OpenJDK
- Install JRE, JDK
- Additional opportunity to install from openjdk-fallback, repositories, s3, web, chocolatey, local source.
Oracle Java:
- 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.
- Version of the ansible for installation: 2.7
- Supported OpenJDK version:
- 8
- EL 6: repositories, tarball
- EL 7: repositories, tarball
- Ubuntu bionic: repositories, tarball
- Debian stretch: repositories, tarball
- 11
- EL 6: tarball
- EL 7: repositories, tarball
- Ubuntu bionic: repositories, tarball
- Debian stretch: tarball
- 12
- EL 6: tarball, openjdk-fallback
- EL 7: tarball, openjdk-fallback
- Ubuntu bionic: tarball, openjdk-fallback
- Debian stretch: tarball, openjdk-fallback
- 8
- Supported oracle java version:
- 7
- 8
- 11
- 12
- Supported OS:
- Ubuntu
- bionic
- xenial
- trusty
- Debian
- stretch
- EL
- 6
- 7
- Windows
- all
- Ubuntu
-
java_package
Java package type.Available:
jdk
(default)jre
-
transport
Artifact source transport. Useopenjdk-fallback
(OpenJDK only),repositories
(OpenJDK only),local
,web
ors3
for more predictable result.Available:
-
repositories
Installing OpenJDK 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) -
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) -
openjdk-fallback
fetching artifact from jdk.java.net.
This is default value fortransport
variableNotice using
s3
transport requires specific packages to be installed on target host:- 'botocore'
- 'boto'
- 'boto3' These packages are not included in given role. You should install them preliminary.
-
-
java_tarball_install
- boolean parameter to choose between tarball and package installation. Default isTrue
. -
java_major_version
- major version of OpenJDK (8,11,12) or oracle-java (6,7,8, 11 etc.) Default is 12. -
java_minor_version
- minor version of oracle-java. For version8.202
minor will be202
(default). For OpenJDK this variable not needed setup manually. -
java_arch
Package architecture. (With installing OpenJDK from repositories its variable you may use only for RHEL )Available:
x64
for x86_64 (default)i586
for x86
-
java_path
Where java package will be installed. Notice Not use this variable if transport = repositories selecteddefault values depend on OS distribution:
- RedHat:
/usr/java
(/usr/lib/jvm
from repositories) - Debian:
/usr/lib/jvm
- Windows:
C:\Program Files\Java
- RedHat:
-
download_path
: Local folder for downloading artifactsLinux default:
/tmp
Windows default:
TEMP environment variable
-
transport_web
URI for http/https artifact e.g. "http://my-storage.com/jdk-8u172-linux-x64.tar.gz" -
transport_web: "https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz"
(OpenJDK 11 for example) -
transport_local
Path for local artifact e.g. "/tmp/jdk-8u172-linux-x64.tar.gz" -
transport_s3_bucket
- s3 bucket namedefault:
s3_bucket
-
transport_s3_path
- path to patch folder in bucketdefault:
/folder
-
transport_s3_aws_access_key
- aws key. Need to be set as parameter or env variables according to https://docs.ansible.com/ansible/latest/modules/aws_s3_module.htmldefault:
{{ lookup('env','AWS_ACCESS_KEY') }}
-
transport_s3_aws_secret_key
- aws secret key. Need to be set as parameter or env variables according to https://docs.ansible.com/ansible/latest/modules/aws_s3_module.htmldefault:
{{ lookup('env','AWS_SECRET_KEY') }}
-
java_unlimited_policy_enabled
- to apply unlimited policydefault:
False
-
java_unlimited_policy_transport
Artifact source transport. Uselocal
,web
ors3
for more predictable result.Available:
web
Fetching artifact from custom web urllocal
Local artifact stored on ansible masters3
artifact in s3 bucket
-
java_unlimited_policy_transport_web
URI for http/https artifact e.g. "http://my-storage.com/jce_policy-8.zip" -
java_unlimited_policy_transport_local
Path for local artifact e.g. "/tmp/jce_policy-8.zip" -
java_unlimited_policy_transport_s3_bucket
- s3 bucket namedefault:
s3_bucket
-
java_unlimited_policy_transport_s3_path
- path to patch folder in bucketdefault:
/folder
ansible-galaxy install lean_delivery.java
- name: Install openjdk java
hosts: all
roles:
- role: lean_delivery.java
- name: Install openjdk java
hosts: all
roles:
- role: lean_delivery.java
transport: repositories
java_major_version: 8
- name: Install openjdk java
hosts: all
roles:
- role: lean_delivery.java
java_major_version: 11
java_tarball_install: True
transport: web
transport_web: https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
- name: Install oracle java
hosts: all
roles:
- role: lean_delivery.java
transport: local
transport_local: /tmp/jdk-8u181-linux-x64.tar.gz
Before install you should prepare host to use aws_s3 module https://docs.ansible.com/ansible/latest/modules/aws_s3_module.html#requirements
- name: Install java
hosts: all
roles:
- role: lean_delivery.java
java_package: jre
java_major_version: 8
transport: s3
transport_s3_bucket: java-s3-bucket
transport_s3_path: /java/jre-8u181-linux-x64.tar.gz
- name: Install java
hosts: windows
roles:
- role: lean_delivery.java
java_package: jdk
transport: chocolatey
java_major_version: 11
java_minor_version: 0.2
Apache
authors:
- Lean Delivery Team team@lean-delivery.com