Ansible Playbook to install OpenJDK JRE
---
- name: Install OpenJDK
hosts: all
become: true
tasks:
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
- name: Install OpenJDK
apt:
name: openjdk-11-jdk
state: present
- name: Verify Java installation
command: java -version
register: java_version
changed_when: false
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow