This role will install and configure Oracle Java 1.8.0_171/172 on RedHat/CentOS and Debian/Ubuntu systems.
- Ansible >=2.4
- EPEL Repo for RedHat/Centos, which can be installed automatically using the common ansible role.
All the variable that can be overridden are stored in vars/main.yml or defaults/main.yml file as shown in the table below:
Name | Default Value | Description |
---|---|---|
java_main_rel |
: 8 | Major Release of Java |
java_min_rel |
: 171 | Minor Release of Java, select 172 or 171 |
java_data_dir |
: /data | The directory where the application data is stored Automatically created by common Role |
java_install_dir |
: /apps | The directory where the application is installed Automatically created by common Role |
java_version |
: "1.{{java_main_rel}}.0_{{java_min_rel}}" | Describes the version of Java that will be installed |
java_src_tar |
: "jdk-{{java_main_rel}}u{{java_min_rel}}-linux-x64.tar.gz" | The Oracle Java Archive |
java_home |
: "{{java_install_dir}}/jdk{{java_version}}" | JAVA_HOME ENV variable |
java_shared_home |
: /usr/shared/java | Symlink to the installed JAVA |
java_profile_sh |
: /etc/profile.d/jdk.sh | Jinja2 Template, which contains the info to source the ENV variables |
{# The defaults PATHS where Ansible looks for the files #}
When executing the playbook from the following path:
$ cd {{ path_on_server }}/
$ ansible-playbook {{playbook_dir}}/playbook.yml
{{ path_on_server }}/roles/{{ ansible_role }}/files/jdk-8u171-linux-x64.zip
{{ path_on_server }}/roles/{{ ansible_role }}/jdk-8u171-linux-x64.zip
{{ path_on_server }}/roles/{{ ansible_role }}/tasks/files/jdk-8u171-linux-x64.zip
{{ path_on_server }}/roles/{{ ansible_role }}/tasks/jdk-8u171-linux-x64.zip
{{ path_on_server }}/{{ playbook_dir }}/files/jdk-8u171-linux-x64.zip
{{ path_on_server }}/{{ playbook_dir }}/jdk-8u171-linux-x64.zip
- hosts: all
become: yes
gather_facts: yes
roles:
- role: common
- hosts: servers
become: yes
gather_facts: yes
roles:
- role: skydevops-java
Licensed under the Apache License V2.0. See the LICENSE file for details.
You can find me on Twitter: @skydevops
- Shashi Yebbare (@skydevops)