forked from ISTI-ansible-roles/ansible-roles
59 lines
2.2 KiB
YAML
59 lines
2.2 KiB
YAML
---
|
|
- block:
|
|
- name: Oracle JDK cannot be installed anymore, unless you are able to provide a local tar file distribution
|
|
fail:
|
|
msg: "Use the openjdk role instead"
|
|
when: not jdk_use_tarfile
|
|
|
|
- block:
|
|
- name: setup the Oracle JDK repository on ubuntu
|
|
apt_repository: repo='{{ jdk_ubuntu_ppa }}' state=present update_cache=yes
|
|
when: is_ubuntu
|
|
|
|
- name: Install the Oracle JDK repository pgp key on debian
|
|
apt_key: keyserver=keyserver.ubuntu.com id={{ jdk_ppa_key }}
|
|
when: is_debian
|
|
|
|
- name: setup the Oracle JDK repository on debian
|
|
apt_repository: repo='{{ jdk_ppa_repo }}' state=present update_cache=yes
|
|
when: is_debian
|
|
|
|
- name: Accept the Oracle Java license
|
|
debconf: name='oracle-java{{ item }}-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'
|
|
with_items: '{{ jdk_version }}'
|
|
|
|
- name: Install the latest version of Oracle JDK
|
|
apt: pkg={{ item }} state={{ jdk_pkg_state }} force=yes update_cache=yes cache_valid_time=1800
|
|
register: jdk_install
|
|
with_items: '{{ oracle_jdk_packages }}'
|
|
|
|
- name: Install the extended security JCE Oracle JDK package
|
|
apt: pkg=oracle-java{{ item }}-unlimited-jce-policy state={{ jdk_pkg_state }} force=yes update_cache=yes cache_valid_time=1800
|
|
with_items: '{{ jdk_version }}'
|
|
when: jdk_install_strong_encryption_policy
|
|
|
|
- name: Set the JDK default via update-alternatives
|
|
apt: pkg=oracle-java{{ item }}-set-default state={{ jdk_pkg_state }} force=yes update_cache=yes cache_valid_time=1800
|
|
with_items: '{{ jdk_default }}'
|
|
when: jdk_default is defined
|
|
notify: Set the default Oracle JDK
|
|
|
|
when: not jdk_use_tarfile
|
|
tags: [ 'oracle_jdk', 'jdk' ]
|
|
|
|
- block:
|
|
- name: Create jvm directory
|
|
file: dest=/usr/lib/jvm state=directory
|
|
when: '{{ jdk_use_tarfile }}'
|
|
|
|
- name: Install a custom version of Oracle JDK from a tar file
|
|
unarchive: src={{ jdk_tarfile_path }} dest={{ jdk_java_home_prefix }} copy={{ jdk_copy_tarfile | default(omit) }} remote_src=yes
|
|
when: '{{ jdk_use_tarfile }}'
|
|
|
|
- name: Set fact jdk_installed
|
|
set_fact: jdk_installed=True
|
|
|
|
when: jdk_use_tarfile
|
|
tags: [ 'oracle_jdk', 'jdk' ]
|
|
|