DEBOPS.JAVA(5)

NAME
debops.java - Manage Java environment using Ansible

SYNOPSIS

debops service/java [--limit group,host,...] [--diff] [--check] [--tags tag1,tag2,...] [--skip-tags tag1,tag2,...] [<ansible-playbook options>] ...

DESCRIPTION

The debops.java Ansible role installs the default Java OpenJRE headless packages for current OS release. It can also be used to install other Java or OpenJDK/OpenJRE versions.

GETTING STARTED

  Support for backported Java versions

The role will install OpenJDK 8 environment on Debian Jessie by default, using the backported packages from the jessie-backports repository. Backports are configured using debops.apt Ansible role; if the debops.java does not detect the debops.apt configuration, it will switch to the default JRE packages available for a given release. Remember to use the provided example playbook, which will configure APT preferences for the ca-certificates-java package.

  Support for Oracle Java packages

To use the non-free Oracle Java packages, check the JavaPackage <https://wiki.debian.org/JavaPackage> page on Debian Wiki to see how to build the proper APT packages with non-free Java. You will need to publish them in a local APT repository. After that, you can change the default Java package in java__base_packages list to your preferred version.

  Conditional installation of Java Development Kit (JDK)

Some environments might require a full Java Development Kit to work correctly, however by default the debops.java role installs only the Java Runtime Environment (JRE). To install the full JDK in a compatible version, you can set the java__install_jdk boolean variable to True, either via Ansible inventory variables or via role dependent variables.

  Example inventory

To configure a Java environment on a specific host, it needs to be added to the [debops_service_java] host group in Ansible inventory:

[debops_service_java]
hostname

  Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.java role:

---
- name: Manage Java environment
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_java' ]
  become: True
  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'
  roles:
    - role: apt_preferences
      tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
      apt_preferences__dependent_list:
        - '{{ java__apt_preferences__dependent_list }}'
    - role: java
      tags: [ 'role::java', 'skip::java' ]

AUTHOR
Nick Janetakis, Maciej Delmanowski

COPYRIGHT
2014-2022, Maciej Delmanowski, Nick Janetakis, Robin Schneider and others