/java_role

Ansible role to install Java OpenJDK

Primary LanguageShellApache License 2.0Apache-2.0

Logo

Build Status Docker Hub pulls

Java Ansible role

This Ansible Role installs java (OpenJDK in a Debian/Ubuntu or CentOS environment.

Getting Started

These instructions will get you a copy of the role for your Ansible playbook.

Once launched, it will install Java using APT Packages (default) or downloading fresh version of Oracle Technology Network.

DISCLAIMER: Because a issue in Debian Jessie/backport repositories we decided to follow the workaround of adding Acquire::Check-Valid-Until no to Debian Jessie configuration while the issue is not solved, with concerns about security it implies. The other option was removing Debian 8 support. Proceed with caution.

Prerequisities

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

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

For testing purposes you will need Python 3.6+ and Pipenv

Installing

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

- src: http://github.com/idealista/java_role.git
  scm: git
  version: 5.0.0
  name: java

or using Ansible Galaxy as origin if you prefer:

- src: idealista.java_role
  version: 5.0.0
  name: java

Alternatively you could find tagged Docker images for Debian Jessie, Debian Stretch, Ubuntu Xenial, Ubuntu Bionic and CentOS 7 in Docker Hub.

Install the role with ansible-galaxy command:

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

Use in a playbook:

---
- hosts: someserver
  roles:
    - java

Usage

Docker Hub

We publish every role version as a Docker image in Docker Hub: https://hub.docker.com/r/idealista/jdk.

You can pull our images by executing:

docker pull idealista/jdk:${JDK_VERSION}-${DOCKER_IMAGE_BASE}-(openjdk-headless)

JDK_VERSION: Preferred JDK version. DOCKER_IMAGE: Currently supporting: jessie/stretch to select between Debian versions, xenial/bionic to select between Ubuntu versions, and 7 to select a CentOS version.

For instance:

docker pull idealista/jdk:8u191-xenial-openjdk-headless

List of versions (tags) can be checked on Docker Hub

Ansible

defaults/main.yml

OpenJDK

A specific OpenJDK version should be selected overriding java_open_jdk_version variable using group vars/host vars:

Operative System OpenJDK version
Debian Jessie 8u171-b11-1~bpo8+1 (default)
Debian Stretch 8u222-b10-1~deb9u1 (default)
Debian Stretch 11.0.4+11-1~deb10u1
Ubuntu Xenial 8u222-b10-1ubuntu1~16.04.1
Ubuntu Xenial 9~b114-0ubuntu1 (default)
Ubuntu Bionic 8u222-b10-1ubuntu1~18.04.1
Ubuntu Bionic 11.0.4+11-1ubuntu2~18.04.3 (default)
CentOS 7 11.0.3.7 (default)

Testing

$ pipenv install -r test-requirements.txt --python 3.6
$ DOCKER_IMAGE_BASE=(debian:jessie-slim|debian:stretch-slim|amd64/ubuntu:xenial|amd64/ubuntu:bionic|centos:7) JDK_VERSION=(`selected_jdk_version` see [.travis.yml](.travis.yml) file to check supported versions) pipenv run molecule test

Note: debian9 (Debian Stretch) will be used as default linux distro if none is provided.

See molecule directory to check possible testing platforms.

Built With

Ansible Packer

Versioning

For the versions available, see the tags on this repository.

Additionaly you can see what change in each version in the CHANGELOG.md file.

Authors

See also the list of contributors who participated in this project.

License

Apache 2.0 License

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

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.