ITPLT-3960 change the lock check timing and move find in-block

This commit is contained in:
bmeehan
2024-08-13 18:29:34 +10:00
parent b6d986b71f
commit 259058980b

View File

@@ -66,26 +66,26 @@
- jdk_downloading_lock.changed - jdk_downloading_lock.changed
# all nodes can wait here in race condition until the completed lock is present # all nodes can wait here in race condition until the completed lock is present
- name: Wait for jdk_download_completed lock to exist - name: try waiting for jdk_download_completed lock to exist
ansible.builtin.wait_for: ansible.builtin.wait_for:
path: "{{ atl_product_home_shared_download_dir }}/temurin-{{ java_major_version }}-jdk_download_completed" path: "{{ atl_product_home_shared_download_dir }}/temurin-{{ java_major_version }}-jdk_download_completed"
state: present state: present
delay: 30 timeout: 10
failed_when: false ignore_errors: true
register: jdk_download_completed register: jdk_download_completed
retries: 5 retries: 5
- name: Find a file called temurin* in atl_product_home_shared_download_dir
ansible.builtin.find:
paths: "{{ atl_product_home_shared_download_dir }}"
patterns: "temurin-{{ java_major_version }}-*.rpm"
file_type: file
recurse: no
size: 1
register: temurin_rpm_file
# as long as we have a valid rpm filepath do the copy/install block # as long as we have a valid rpm filepath do the copy/install block
- block: - block:
- name: Find a file called temurin* in atl_product_home_shared_download_dir
ansible.builtin.find:
paths: "{{ atl_product_home_shared_download_dir }}"
patterns: "temurin-{{ java_major_version }}-*.rpm"
file_type: file
recurse: no
size: 1
register: temurin_rpm_file
- name: set fact of the basename of the temurin file - name: set fact of the basename of the temurin file
ansible.builtin.set_fact: ansible.builtin.set_fact:
temurin_src_path: "{{ item.path }}" temurin_src_path: "{{ item.path }}"
@@ -103,14 +103,14 @@
state: present state: present
register: dnf_installed register: dnf_installed
when: when:
- jdk_download_completed.state == "directory" - jdk_download_completed.state is defined
- temurin_rpm_file.files - temurin_rpm_file.files is defined
- temurin_rpm_file.files | length > 0 - temurin_rpm_file.files | length > 0
always:
- name: Always ensure Eclipse Temurin JDK is present (get from internet if cache install fails or is unavailable) - name: Ensure Eclipse Temurin JDK is present (get from internet if cache install fails or is unavailable)
ansible.builtin.yum: ansible.builtin.yum:
name: "temurin-{{ java_major_version }}-jdk" name: "temurin-{{ java_major_version }}-jdk"
state: present state: present
- name: Ensure common JDK symlink exists - name: Ensure common JDK symlink exists
community.general.alternatives: community.general.alternatives: