java
Ansible Role: Java
Installs Java on Ubuntu LTS using:
What is so special about this Java role
- No need to know actual package name(s). Just follow the instructions below
- One role to install OpenJDK and Oracle Java at the same time (if configured)
- Supports Ubuntu 14.04, 16.04, 18.04 and 20.04 only
- Testing with Molecule 3
Requirements
None.
Role Variables
Available variables are listed below, along with examples values (see defaults/main.yml):
OpenJDK versions and types to install. OpenJDK currently supports installing JDK 6-17. Not every JDK version is supported for every Ubuntu version. Refer to the PPA page for more details. Also, it's possible to install JRE or JDK:
java_openjdk_packages:
- version: 11
type: jre
Oracle Java versions to install. Oracle Java supports installing JDK 16 only. It's not possible to select package type. Only the version key is supported:
java_oracle_packages: []
Example (do not forget to remove square brackets):
java_oracle_packages:
- version: 16
Default Java to use. Also affects JAVA_HOME environment variable (will be pointing to the same location). Possible keys:
- provider: Java flavor to use. Possible options are
oracle
oropenjdk
- version: Default Java version. Possible options 6-17 (OpenJDK) (however not every Java version is supported for every Ubuntu version) and 16 (Oracle Java)
java_default_alternative:
provider: openjdk
version: 11
Dependencies
None.
Example Playbook
- hosts: all
roles:
- T2L.java
License
MIT
Author Information
This role was created in 2017-2021 by Roman Paska.
Changelog
Changelog can be found here CHANGELOG.md
ansible-galaxy install T2L/ansible-role-java