An Ansible role to install and configure Java on Debian-based and RedHat-based systems.
Date | Version | Description | Changed By |
---|---|---|---|
June 2020 | v1.0 | Initial Draft | Sudipt Sharma |
May 2025 | v1.1 | Molecule Integration | Abhishek Vishwakarma |
- Installs Java (default is Java 17).
- Supports overriding the version via role variables.
- Supports both Debian-based and RedHat-based distributions.
- Optionally sets the
JAVA_HOME
environment variable.
You can customize the Java version using the following variables:
Variable | Default Value | Description |
---|---|---|
java_version_redhat |
java-17-openjdk |
Java version for RedHat-based OS |
java_version |
openjdk-17-jdk |
Java version for Debian-based OS |
[javahost]
192.168.1.198 ansible_user=ubuntu
192.168.3.201 ansible_user=opstree
- Here is an example playbook
site.yml
:-
- hosts: javahost
roles:
- role: java
Run it using:
- ansible-playbook site.yml
After successful installation of java, verify it with:
java -version
To test this role using Molecule, refer to the Molecule Test Documentation.
For questions, suggestions, or issues related to this role, please contact:
📧 Email: [email protected]
🏢 Organization: OpsTree Solutions