Skip to content

Ansible role for installing a AdoptOpenJDK Java VM in Debian or CentOS

License

Notifications You must be signed in to change notification settings

sfuhrm/adoptopenjdk_role

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AdoptOpenJDK Ansible role

This Ansible Role installs the AdoptOpenJDK Java VM as a package in a Debian/Ubuntu or CentOS environment.

Getting Started

Prerequisities

To use this role as dependency in your playbook, prerequisites are described below:

  • Ansible 2.4 version installed.
  • Inventory destination should be a Debian/Ubuntu or CentOS environment.

Configuring

The role has some defaults set as variables. If you want to override them, set the following variables in one the appropriate ansible places:

  • adoptopenjdk_package: adoptopenjdk-13-hotspot

    This is the OS package name to install. See below for a list for Debian based systems.

  • adoptopenjdk_state: present

    This is either present to install Java or absent to deinstall it.

Possible package names on Debian-based systems:

adoptopenjdk-11-hotspot
adoptopenjdk-11-hotspot-jre
adoptopenjdk-11-openj9
adoptopenjdk-11-openj9-jre
adoptopenjdk-11-openj9xl
adoptopenjdk-11-openj9xl-jre
adoptopenjdk-12-hotspot
adoptopenjdk-12-hotspot-jre
adoptopenjdk-12-openj9
adoptopenjdk-12-openj9-jre
adoptopenjdk-12-openj9xl
adoptopenjdk-12-openj9xl-jre
adoptopenjdk-13-hotspot
adoptopenjdk-13-hotspot-jre
adoptopenjdk-13-openj9
adoptopenjdk-13-openj9-jre
adoptopenjdk-13-openj9xl
adoptopenjdk-13-openj9xl-jre
adoptopenjdk-8-hotspot
adoptopenjdk-8-hotspot-jre
adoptopenjdk-8-openj9
adoptopenjdk-8-openj9-jre
adoptopenjdk-8-openj9xl
adoptopenjdk-8-openj9xl-jre

Installing

Create or add to your roles dependency file (e.g requirements.yml):

- src: http://github.com/sfuhrm/adoptjopendk_role.git
  scm: git
  version: master
  name: adoptopenjdk_role

or using Ansible Galaxy as origin if you prefer:

- src: sfuhrm.adoptopenjdk_role
  version: master
  name: adoptopenjdk_role

Install the role with the ansible-galaxy command:

$ ansible-galaxy install -p roles -r requirements.yml -f

Use in a playbook:

---
- hosts: someserver
  roles:
    - adoptopenjdk_role

Usage

Ansible

The defaults for the role can be seen in defaults/main.yml.

OpenJDK

A specific AdoptOpenJDK version can be selected by overriding the adoptopenjdk_package variable using group_vars/host_vars/playbook.yml vars:

License

Apache 2.0 License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.