srsp.oracle-java

srsp.oracle-java for Ansible Galaxy

Build Status

Overview

Role name in Ansible Galaxy: srsp.oracle-java

This Ansible role allows you to manage the Oracle JDK with the following features:

  • Installs Oracle JDK versions 8 to 13.
  • Optional installation of Java Cryptography Extensions (JCE) for JDK versions 8u152 and older. More information here.
  • Compatible with CentOS, Debian/Ubuntu, SUSE, and macOS.

This role is based on williamyeh.oracle-java, but includes newer Java versions and does not support older releases.

If you prefer OpenJDK, check out geerlingguy.java.

Automatic Download from Oracle

Note: Previously, this role could download JDKs directly from Oracle. Oracle has since restricted this access. You can no longer download any JDK 8 version without an Oracle login, and only one older version of JDK 11 can be downloaded. JDK 13 is available for download at the moment.

Since Oracle’s download policies change frequently with each Java release, it’s better to download the JDK manually and then use this role to install it.

Role Variables

Basic Usage

To download and install the JDK from Oracle, use the following:

- hosts: all

  roles:
    - srsp.oracle-java

  vars:
    # Set this to the desired version:
    - java_version: 13
    # Optional: leave this out for the latest known subversion:
    - java_subversion: 0.2

Examples

Install a Manually Downloaded JDK

If you've downloaded the JDK file, place it in the files directory and set java_download_from to local:

- hosts: all

  roles:
    - srsp.oracle-java

  vars:
    - java_version: 8
    - java_subversion: 201
    - java_download_from: local

Install from Your Mirror

You can also install JDK from a specified URL:

- hosts: all

  roles:
    - srsp.oracle-java

  vars:
    - java_version: 8
    - java_subversion: 172
    - java_download_from: mirror
    - java_mirror: "http://some.url/in/your/network/jdk-8u172-macosx-x64.dmg"

Download JDK Locally (Prefetch)

If you want to just download the JDK to your local machine (for tests or to upload elsewhere), you can use the prefetch.yml playbook in this role:

ansible-playbook prefetch.yml

Modify the playbook as needed.

Running from the Command Line

ansible-playbook --ask-become-pass playbook.yml

Optional Variables

You can configure these default settings:

# Java Version
java_version: 8

# Java Subversion
java_subversion: 201

# Where to download Java from
# - oracle: Download directly from Oracle website.
# - mirror: Download from the specified 'java_mirror' URL.
# - local: Copy from the `files` directory of the role on the control machine.
java_download_from: oracle

# Use this if downloading from 'mirror' to set the URL.
java_mirror: "http://download.oracle.com/otn-pub/java"

# Delete temporary downloaded files?
java_remove_download: true

# Set JAVA_HOME environment variable?
java_set_java_home: true

# Install Java Cryptography Extensions?
java_install_jce: false

For more configuration options, check the tasks/set-role-variables.yml file.

Installing an Unsupported JDK

If you need a JDK version not currently supported, specify the Java build number and its hash as follows:

# file: playbook.yml
- hosts: all

  roles:
    - srsp.oracle-java

  vars:
    - java_version: 8
    - java_subversion: 141
    - java_build: 15
    - jdk_tarball_hash: 336fa29ff2bb4ef291e347e091f7f4a7

License

Licensed under the Apache License V2.0. See the LICENSE file for more information.

Development

Testing

Tests use molecule, and since this role needs an Oracle JDK, the molecule test containers will use /tmp/java so that the JDK remains available even after the test container is destroyed. You can also prefetch the installation file and place it in /tmp/java.

To run the default test scenario:

molecule test

For a specific distribution, use:

molecule converge --scenario-name opensuse15

To test everything:

molecule test --all

This will take some time.

Informazioni sul progetto

Oracle JDK 8 to 13 for CentOS/Fedora/Debian/Ubuntu/Suse/MacOSX

Installa
ansible-galaxy install srsp.oracle-java
Licenza
apache-2.0
Download
186.3k
Proprietario
Doing software things @holisticon