/ansible-oracle-java

An Ansible role that installs Oracle JDK, in the format for Ansible Galaxy.

Primary LanguageShellApache License 2.0Apache-2.0

williamyeh.oracle-java for Ansible Galaxy

Build Status Circle CI

Summary

Role name in Ansible Galaxy: williamyeh.oracle-java

This Ansible role has the following features for Oracle JDK:

  • Install JDK 7 or 8 version.
  • Install optional Java Cryptography Extensions (JCE)
  • Install for CentOS and Debian/Ubuntu families.

If you prefer OpenJDK, try alternatives such as smola.java or geerlingguy.java.

Role Variables

Mandatory variables

None.

Optional variables

User-configurable defaults:

# which version?
java_version: 8

# which subversion?
java_subversion: 77

# which directory to put the download file (for CentOS families)?
java_download_path: /tmp

# rpm/tar.gz file location:
#   - true: download from Oracle on-the-fly;
#   - false: copy from `{{ playbook_dir }}/files`.
java_download_from_oracle: true

# remove temporary downloaded files?
java_remove_download: true

# install JCE?
java_install_jce: false

For other configurable internals, read tasks/set-role-variables.yml file; for example, supported java_version/java_subversion combinations.

Usage

Step 1: add role

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

Step 2: add variables

Set vars in your playbook file.

Simple example:

---
# file: simple-playbook.yml

- hosts: all

  roles:
    - williamyeh.oracle-java

  vars:
    java_version: 8

(Optionally) pre-fetch .rpm and .tar.gz files

For some reasons, you may want to pre-fetch .rpm and .tar.gz files before the execution of this role, instead of downloading from Oracle on-the-fly.

To do this, put the file on the {{ playbook_dir }}/files directory in advance, and then set the java_download_from_oracle variable to false:

---
# file: prefetch-playbook.yml

- hosts: all

  roles:
    - williamyeh.oracle-java

  vars:
    java_version: 8
    java_download_from_oracle: false

Dependencies

License

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

History

Rewritten from my pre-Galaxy version: server-config-template.