Ansible Role - Java
Installs Java for RedHat/CentOS and Debian/Ubuntu linux servers.
Available variables are listed below, along with default values:
# The defaults provided by this role are specific to each distribution. java_packages: - java-1.8.0-openjdk
Set the version/development kit of Java to install, along with any other necessary Java packages. Some other options include are included in the distribution-specific files in this role's 'defaults' folder.
If set, the role will set the global environment variable
JAVA_HOMEto this value.
- hosts: servers roles: - role: geerlingguy.java become: yes
For RHEL / CentOS:
- hosts: server roles: - role: geerlingguy.java when: "ansible_os_family == 'RedHat'" java_packages: - java-1.8.0-openjdk
For Ubuntu < 16.04:
- hosts: server tasks: - name: installing repo for Java 8 in Ubuntu apt_repository: repo='ppa:openjdk-r/ppa'
MIT / BSD