ansiblebit / oracle-java

Ansible role to install Oracle Java 8/11 on Debian and RedHat based distributions.
https://galaxy.ansible.com/ansiblebit/oracle-java/
BSD 3-Clause "New" or "Revised" License
141 stars 84 forks source link
ansible centos centos7 debian debian-jessie java oracle redhat ubuntu ubuntu-cosmic ubuntu-precise ubuntu-trusty ubuntu-xenial

ansiblebit.oracle-java

License Build Status

Platform Platform Platform Platform

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

Family Distribution Version Test Status
Debian Debian Jessie x86_64
Debian Debian Stretch x86_64
Debian Ubuntu Precise x86_64
Debian Ubuntu Yakkety x86_64
Debian Ubuntu Xenial x86_64
Debian Ubuntu Trusty x86_64
Debian Ubuntu Vivid x86_64
Debian Ubuntu Wily x86_64
Debian Ubuntu Artful x86_64
Debian Ubuntu Bionic x86_64
Debian Ubuntu Cosmic x86_64
RedHat Centos 7 x86_64

Requirements

Facts

Role Variables

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.

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.

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.

Playbooks

# generic
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | Java 12
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | Java 11
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java
      oracle_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: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | ubuntu | Java 12
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | ubuntu | Java 11
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java
      oracle_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: servers
  roles:
    - role: ansiblebit.oracle-java

# redhat | centos 7 | Java 11
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java
      oracle_java_use_defaults: no
      oracle_java_dir_source: '/usr/local/src'
      oracle_java_download_timeout: 60
      oracle_java_rpm_filename: 'jdk-11.0.3_linux-x64_bin.rpm'
      oracle_java_home: '/usr/java/default'
      oracle_java_os_supported: yes
      oracle_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: yes
      oracle_java_set_as_default: no
      oracle_java_version_string: 11.0.3

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

## Test

```bash
tox -e py27-ansible26 -- --box centos7-64.vagrant.dev

tox -e py27-ansible26 -- --box bionic64.vagrant.dev

# manual
source .tox/py27-ansible26/bin/activate
cd tests
vagrant up bionic64.vagrant.dev

bash test_idempotence.sh \
  --box bionic64.vagrant.dev \
  --inventory .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory

## look at idempotence test logs
less log/bionic64.vagrant.dev_idempotence_py27-ansible26.log

## debug
vagrant ssh bionic64.vagrant.dev

bash test_checkmode.sh \
  --box bionic64.vagrant.dev \
  --inventory .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory

## look at checkmode test logs
less log/bionic64.vagrant.dev_checkmode_py27-ansible26.log

vagrant destroy bionic64.vagrant.dev

Links