diff --git a/oracle-jdk/defaults/main.yml b/oracle-jdk/defaults/main.yml index 0b2bedc..fee9296 100644 --- a/oracle-jdk/defaults/main.yml +++ b/oracle-jdk/defaults/main.yml @@ -15,7 +15,7 @@ jdk_ubuntu_ppa: 'ppa:webupd8team/java' jdk_ppa_repo: 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main' jdk_ppa_key: 7B2C3B0889BF5709A105D03AC2518248EEA14886 -# If we want a different oracle jdk set the following variables in the local playbook: +# If we want a different oracle jdk set the following variables in the local playbook. The JDK tar file must be on the target machine already: jdk_use_tarfile: False -# jdk_java_home: /usr/lib/jvm/java-7-0-25 -# jdk_tarfile: oracle-jdk-7.0.25.tar.gz +# jdk_java_home: /usr/lib/jvm/java- +# jdk_tarfile: /absolute/path/to/oracle-jdk-.tar.gz diff --git a/oracle-jdk/tasks/main.yml b/oracle-jdk/tasks/main.yml index 7b8897f..861dd16 100644 --- a/oracle-jdk/tasks/main.yml +++ b/oracle-jdk/tasks/main.yml @@ -18,32 +18,32 @@ - name: Install the latest version of Oracle JDK apt: pkg={{ item }} state={{ jdk_pkg_state }} force=yes update_cache=yes cache_valid_time=1800 - when: not jdk_use_tarfile 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: - - not jdk_use_tarfile - - jdk_install_strong_encryption_policy + 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: - - not jdk_use_tarfile - - jdk_default is defined + when: jdk_default is defined notify: Set the default Oracle JDK + when: not jdk_use_tarfile + tags: [ 'oracle_jdk', 'jdk' ] + +- block: - name: Install a custom version of Oracle JDK from a tar file - unarchive: src={{ jdk_tarfile }} dest={{ jdk_java_home_prefix }} copy={{ jdk_copy_tarfile | default(omit) }} + unarchive: src={{ jdk_tarfile }} 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' ] - block: