diff --git a/roles/product_common/defaults/main.yml b/roles/product_common/defaults/main.yml index 6c9fae9..04d2024 100644 --- a/roles/product_common/defaults/main.yml +++ b/roles/product_common/defaults/main.yml @@ -15,4 +15,5 @@ debian_architecture_translations: debian_architecture: "{{ debian_architecture_translations[ansible_architecture] | default(ansible_architecture) }}" # path to store jdk download -atl_product_home_shared_download_dir: "{{ atl_shared_mountpoint }}/downloads" \ No newline at end of file +atl_product_home_shared_download_dir: "{{ atl_shared_mountpoint }}/downloads" +atl_jdk_download_lock_timeout: 300 diff --git a/roles/product_common/tasks/amazon-2023.yml b/roles/product_common/tasks/amazon-2023.yml index e312008..e28147b 100644 --- a/roles/product_common/tasks/amazon-2023.yml +++ b/roles/product_common/tasks/amazon-2023.yml @@ -32,6 +32,9 @@ path: "{{ atl_product_home_shared_download_dir }}/temurin-{{ java_major_version }}-jdk_downloading" state: directory register: jdk_downloading_lock + failed_when: + - jdk_downloading_lock is failed + - "'File exists' not in jdk_downloading_lock.msg | default('')" when: - jdk_download_completed_lock - not jdk_download_completed_lock.stat.exists @@ -69,15 +72,20 @@ - jdk_downloading_lock - jdk_downloading_lock.changed - # all nodes can wait here in race condition briefly for dl to complete and the downloaded_lock to exist - - name: wait and test 5 times for jdk_download_completed lock to exist + - name: Wait for jdk_downloading lock directory to be released ansible.builtin.wait_for: + path: "{{ atl_product_home_shared_download_dir }}/temurin-{{ java_major_version }}-jdk_downloading" + state: absent + timeout: "{{ atl_jdk_download_lock_timeout }}" + msg: >- + {{ atl_product_home_shared_download_dir }}/temurin-{{ java_major_version }}-jdk_downloading + still exists after {{ atl_jdk_download_lock_timeout }}s; remove it if no node is downloading the JDK + when: not jdk_download_completed_lock.stat.exists + + - name: Check if jdk_download_completed lock directory exists after waiting + ansible.builtin.stat: path: "{{ atl_product_home_shared_download_dir }}/temurin-{{ java_major_version }}-jdk_download_completed" - state: present - timeout: 10 - ignore_errors: true register: jdk_download_completed_lock - retries: 5 # as long as we have a valid rpm filepath do the copy/install block - block: @@ -108,8 +116,7 @@ - temurin_file_path is defined when: - - jdk_download_completed_lock.state is defined - - jdk_download_completed_lock.state == "directory" + - jdk_download_completed_lock.stat.isdir | default(false) - name: Ensure Eclipse Temurin JDK is present (get from internet if cache install fails or is unavailable) ansible.builtin.command: