Don't download rpm if already downloaded
I've run into some errors from Ansible trying to download the Oracle
rpm. Looks like maybe Oracle is requiring authentication now, not sure.
In any case, no point in fetching the rpm if it is already downloaded.
#
---
-# Install Orcal Java
+- name: Check if oracle java 8 rpm already downloaded
+ stat:
+ path: "{{ java_dir_source }}/{{ java_rpm_filename }}"
+ register: rpm_stat_result
+
+# Install Oracle Java
- name: download oracle java 8 rpm
get_url: url="{{ java_rpm_url }}" dest="{{ java_dir_source }}" headers='Cookie:oraclelicense=accept-securebackup-cookie'
become: yes
tags:
- always
+ when: not rpm_stat_result.stat.exists
- name: Install oracle java 8
yum: name="{{ java_dir_source }}/{{ java_rpm_filename }}" state=present
