William-Yeh.oracle_java

williamyeh.oracle-java for Ansible Galaxy

Build Status Circle CI

Overview

Role name in Ansible Galaxy: williamyeh.oracle-java

This Ansible role installs Oracle JDK and offers these features:

  • Install JDK version 7 or 8.
  • Optionally install Java Cryptography Extensions (JCE).
  • Compatible with CentOS, Debian/Ubuntu, SUSE, and Mac OS X.

If you want to use OpenJDK, consider geerlingguy.java or smola.java.

Role Variables

Required variables

None.

Optional variables

User-configurable settings:

# Which Java version to install?
java_version: 8

# Which subversion?
java_subversion: 112

# Where to download the file?
java_download_path: /tmp

# Download option:
#   - true: download from Oracle directly;
#   - false: copy from `{{ playbook_dir }}/files` on the control machine.
java_download_from_oracle: true

# Delete temporary files after download?
java_remove_download: true

# Set $JAVA_HOME environment variable?
java_set_javahome: false

# Install JCE?
java_install_jce: false

For more details on other variables, check tasks/set-role-variables.yml.

To install a non-standard Java release, you need to provide its build number with java_build along with java_version and java_subversion:

---
- hosts: all

  roles:
    - williamyeh.oracle-java

  vars:
    java_version: 8
    java_subversion: 91
    java_build: 14

Custom Variables (if needed)

If you have already downloaded a JDK file and the script can’t name it automatically, you can specify it manually:

# Provide the exact filename (without .tar.gz, .rpm, or .dmg);
# This is used with `java_download_from_oracle: false`.

jdk_tarball_file

# For example, if you have a local file named `files/jdk-7u79-linux-x64.tar.gz`,
# but the script can't name it automatically, use these variables in your playbook:
#
#    java_version:    7
#    java_subversion: 79
#    java_download_from_oracle: false
#    jdk_tarball_file: jdk-7u79-linux-x64
#

How to Use

Step 1: Add the Role

Add the role name williamyeh.oracle-java to your playbook.

Step 2: Set Variables

Define variables in your playbook.

Simple example:

---
# file: simple-playbook.yml

- hosts: all

  roles:
    - williamyeh.oracle-java

  vars:
    java_version: 8

(Optional) Prepare .rpm and .tar.gz Files

If you prefer to download .rpm and .tar.gz files before the role runs instead of directly from Oracle, you can do this by placing the files in the {{ playbook_dir }}/files directory first and then setting java_download_from_oracle to false:

---
# file: prefetch-playbook.yml

- hosts: all

  roles:
    - williamyeh.oracle-java

  vars:
    java_version: 8
    java_download_from_oracle: false

Dependencies

(Add any dependencies here)

License

This project is licensed under the Apache License V2.0. See the LICENSE file for more information.

History

This documentation was rewritten from an earlier version: server-config-template.

Informazioni sul progetto

Oracle JDK 7/8 for CentOS/Debian/Ubuntu/Suse/MacOSX

Installa
ansible-galaxy install William-Yeh.oracle_java
Licenza
apache-2.0
Download
58.2k
Proprietario