ansible-roles/oracle-jdk/tasks/main.yml

50 lines
1.5 KiB
YAML

---
- name: setup the Oracle JDK repository
apt_repository: repo='ppa:webupd8team/java'
register: update_apt_cache
tags: jdk
- 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
tags: jdk
- name: Update the apt cache
apt: update_cache=yes
when: update_apt_cache.changed or jdk_pkg_state == 'latest'
tags: jdk
- name: Install the latest version of Oracle JDK
apt: pkg={{ item }} state={{ jdk_pkg_state }} force=yes
when: not jdk_use_tarfile
with_items: oracle_jdk_packages
tags: jdk
- name: Install the extended security JCE Oracle JDK package
apt: pkg=oracle-java{{ item }}-unlimited-jce-policy state={{ jdk_pkg_state }} force=yes
when: jdk_use_tarfile is not defined or not jdk_use_tarfile
with_items: jdk_version
when:
- not jdk_use_tarfile
- jdk_install_strong_encryption_policy
tags: jdk
- name: Set the JDK default via update-alternatives
apt: pkg=oracle-java{{ item }}-set-default state={{ jdk_pkg_state }} force=yes
with_items: jdk_default
when:
- not jdk_use_tarfile
- jdk_default is defined
notify: Set the default Oracle JDK
tags: jdk
- name: Install a custom version of Oracle JDK from a tar file
unarchive: src={{ jdk_tarfile }} dest={{ jdk_java_home_prefix }}
when: jdk_use_tarfile
tags: jdk
- name: Set fact jdk_installed
set_fact: jdk_installed=True
tags: jdk