Skip to content

Repository files navigation

ansiblebit.oracle-java

LicenseBuild Status

PlatformPlatformPlatformPlatform

Project Stats

An Ansible role to setup Oracle Java Development Kit.

DISCLAIMER: usage of any version of this role implies you have accepted the Oracle Binary Code License Agreement for Java SE.

Tests

FamilyDistributionVersionTest Status
DebianDebianJessiex86_64
DebianDebianStretchx86_64
DebianUbuntuPrecisex86_64
DebianUbuntuYakketyx86_64
DebianUbuntuXenialx86_64
DebianUbuntuTrustyx86_64
DebianUbuntuVividx86_64
DebianUbuntuWilyx86_64
DebianUbuntuArtfulx86_64
DebianUbuntuBionicx86_64
DebianUbuntuCosmicx86_64
RedHatCentos7x86_64

Requirements

  • ansible >= 2.x

Facts

  • oracle_java_installed: fact set by this role that contains a flag that indicates if Java is installed on the host.
  • oracle_java_version_installed: fact set by this role that contains the string of the Java version installed in the system.

Role Variables

  • debug: flag to make role more verbose.
  • oracle_java_set_as_default: flag to indicate if this play should set Java as default (default: yes).
  • oracle_java_use_defaults: flag to indicate you want to use defaults set in the defaults directory (default: yes). WARNING. setting this to no will require the user to pass all of the distribution variables. See * | Java 11 examples in the Playbooks section.

Debian

WARNING to override any of the following variables (even if it's only one), you'll need to set oracle_java_use_defaults: no and override all of their values since OS family defaults will no longer be loaded. See debian | Java 11 example in the Playbooks section.

  • oracle_java_apt_repository: Personal Package Archive (PPA) from where to install Java.
  • oracle_java_apt_repository_key: PPA repository key.
  • oracle_java_cache_valid_time: the amount of time in seconds the apt cache is valid.
  • oracle_java_deb_package: name of debian package.
  • oracle_java_debconf_package_default: name of debconf package to set default.
  • oracle_java_home: the location of the Java home directory.
  • oracle_java_state:** the package state (see Ansible apt module for more information).

Debian/Ubuntu

WARNING to override any of the following variables (even if it's only one), you'll need to set oracle_java_use_defaults: no and override all of their values since OS family defaults will no longer be loaded. See debian | ubuntu | Java 11 example in the Playbooks section.

  • oracle_java_apt_repository: Personal Package Archive (PPA) from where to install Java.
  • oracle_java_cache_valid_time: the amount of time in seconds the apt cache is valid.
  • oracle_java_deb_package: name of debian package.
  • oracle_java_debconf_package_default: name of debconf package to set default.
  • oracle_java_home: the location of the Java home directory.
  • oracle_java_license_version: which Oracle license version you will be accepting.
  • oracle_java_state:** the package state (see Ansible apt module for more information).

Redhat-only

WARNING to override any of the following variables (even if it's only one), you'll need to set oracle_java_use_defaults: no and override all of their values since OS family defaults will no longer be loaded. See redhat | centos 7 | Java 11 example in the Playbooks section.

  • oracle_java_dir_source: directory where to store the RPM files.
  • oracle_java_download_timeout: download timeout, in seconds.
  • oracle_java_home: the location of the Java home directory.
  • oracle_java_rpm_filename: file name used for the download destination.
  • oracle_java_rpm_url: where to download the rpm from.
  • oracle_java_rpm_validate_certs: flag to indicate if you want SSL certificate validation.
  • oracle_java_version_string: the Java version string to verify installation against.

Playbooks

# generic
- hosts: serversroles:
- role: ansiblebit.oracle-java# debian | Java 12
- hosts: serversroles:
- role: ansiblebit.oracle-java# debian | Java 11
- hosts: serversroles:
- role: ansiblebit.oracle-javaoracle_java_deb_package: 'oracle-java11-installer'oracle_java_debconf_package_default: 'oracle-java11-set-default'oracle_java_home: "/usr/lib/jvm/java-11-oracle"## explicitely passing default parameters
- hosts: serversroles:
- role: ansiblebit.oracle-java# debian | ubuntu | Java 12
- hosts: serversroles:
- role: ansiblebit.oracle-java# debian | ubuntu | Java 11
- hosts: serversroles:
- role: ansiblebit.oracle-javaoracle_java_deb_package: 'oracle-java11-installer'oracle_java_debconf_package_default: 'oracle-java11-set-default'oracle_java_home: "/usr/lib/jvm/java-11-oracle"# redhat | centos 7 | Java 12
- hosts: serversroles:
- role: ansiblebit.oracle-java# redhat | centos 7 | Java 11
- hosts: serversroles:
- role: ansiblebit.oracle-javaoracle_java_use_defaults: nooracle_java_dir_source: '/usr/local/src'oracle_java_download_timeout: 60oracle_java_rpm_filename: 'jdk-11.0.3_linux-x64_bin.rpm'oracle_java_home: '/usr/java/default'oracle_java_os_supported: yesoracle_java_rpm_url: 'https://download.oracle.com/otn/java/jdk/11.0.3+12/37f5e150db5247ab9333b11c1dddcd30/jdk-11.0.3_linux-x64_bin.rpm'oracle_java_rpm_validate_certs: yesoracle_java_set_as_default: nooracle_java_version_string: 11.0.3

Use --skip-tags=debug if you want to suppress debug information.

## Test```bashtox -e py27-ansible26 -- --box centos7-64.vagrant.devtox -e py27-ansible26 -- --box bionic64.vagrant.dev# manualsource .tox/py27-ansible26/bin/activatecd testsvagrant up bionic64.vagrant.devbash test_idempotence.sh \ --box bionic64.vagrant.dev \ --inventory .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory## look at idempotence test logsless log/bionic64.vagrant.dev_idempotence_py27-ansible26.log## debugvagrant ssh bionic64.vagrant.devbash test_checkmode.sh \ --box bionic64.vagrant.dev \ --inventory .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory## look at checkmode test logsless log/bionic64.vagrant.dev_checkmode_py27-ansible26.logvagrant destroy bionic64.vagrant.dev

Links

Releases

Packages

Used by

Contributors

Languages