mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 08:23:06 -06:00
ITOPSENG-164 Further testing required for logic change
This commit is contained in:
@@ -130,26 +130,27 @@
|
||||
# shared home to ensure all subsequent nodes have access
|
||||
# to the same specific version binary.
|
||||
# To prevent a race condition with multiple downloads at the same time
|
||||
# a directory is used as a lockfile (atomic operation).
|
||||
# a directory is used as a lockfile (atomic operation) when moving binary.
|
||||
|
||||
- name: Assume temp binary should be downloaded and used
|
||||
- name: Set assumptions to avoid race condition
|
||||
set_fact:
|
||||
download_binary: true
|
||||
move_binary: false
|
||||
atl_product_download: "{{ atl_product_temp_download }}"
|
||||
|
||||
# Check for product installer in home_shared and lockdir to determine
|
||||
# if it needs to be downloaded again.
|
||||
- name: Check moving lock directory does not exist
|
||||
- name: Check for moving lock directory
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
register: moving_lock
|
||||
|
||||
- name: Check downloaded lock directory exists
|
||||
- name: Check for downloaded lock directory
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||
register: downloaded_lock
|
||||
|
||||
- name: Check for presence of product installer in home_shared
|
||||
- name: Check for product installer in home_shared
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_download }}"
|
||||
register: home_shared_download
|
||||
@@ -188,60 +189,76 @@
|
||||
state: link
|
||||
force: true
|
||||
|
||||
# # Product is installed. If the following are true, move to home_shared
|
||||
# # 1. This node just downloaded binary.
|
||||
# # 2. Another node is not already moving into place.
|
||||
# - name: "Move product installer"
|
||||
# block:
|
||||
# Product is installed. If the following are true, move to home_shared
|
||||
# 1. This node just downloaded binary.
|
||||
# 2. Another node is not already moving into place.
|
||||
- name: "Move product installer"
|
||||
block:
|
||||
|
||||
# - name: Check moving lock directory does not exist
|
||||
# stat:
|
||||
# path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
# register: moving_lock
|
||||
- name: Check again for moving lock directory
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
register: moving_lock_2
|
||||
|
||||
# - name: Check downloaded lock directory exists
|
||||
# stat:
|
||||
# path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||
# register: downloaded_lock
|
||||
- name: Check again for downloaded lock directory
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||
register: downloaded_lock_2
|
||||
|
||||
# - name: Check for presence of product installer in home_shared
|
||||
# stat:
|
||||
# path: "{{ atl_product_home_shared_download }}"
|
||||
# register: home_shared_download
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# - name: Remove lockdir to prevent nodes relying on binary when copying
|
||||
# file:
|
||||
# path: "{{ atl_product_home_shared_download_lockdir }}"
|
||||
# state: absent
|
||||
# when: atl_product_downloaded is succeeded
|
||||
# register: lockdir_removed
|
||||
|
||||
# - name: Copy temp installer to home_shared
|
||||
# copy:
|
||||
# src: "{{ atl_product_download }}"
|
||||
# dest: "{{ atl_product_home_shared_download }}"
|
||||
# remote_src: true
|
||||
# when: lockdir_removed is succeeded
|
||||
# register: copied
|
||||
|
||||
# - name: Delete old temp installer
|
||||
# file:
|
||||
# path: "{{ atl_product_download }}"
|
||||
# state: absent
|
||||
# when: copied is succeeded
|
||||
# register: temp_deleted
|
||||
|
||||
# - name: Create lockdir once product installer downloaded and moved
|
||||
# file:
|
||||
# path: "{{ atl_product_home_shared_download_lockdir }}"
|
||||
# state: directory
|
||||
# when: temp_deleted is succeeded
|
||||
- name: Check again for product installer in home_shared
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_download }}"
|
||||
register: home_shared_download_2
|
||||
|
||||
# If binary exists and lockdir exists use this binary instead
|
||||
- name: Check lock directory and binary exists on shared_home
|
||||
set_fact:
|
||||
move_binary: true
|
||||
atl_product_download: "{{ atl_product_home_shared_download }}"
|
||||
when:
|
||||
- home_shared_download.stat.exists == False
|
||||
- ( downloaded_lock.stat.isdir is not defined or downloaded_lock.stat.isdir == False )
|
||||
- ( moving_lock.stat.isdir is not defined or moving_lock.stat.isdir == False )
|
||||
|
||||
- name: Create moving_lock to ensure other nodes skip
|
||||
file:
|
||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
state: directory
|
||||
when: move_binary
|
||||
register: moving_lock_created
|
||||
|
||||
- name: Copy temp installer to home_shared
|
||||
copy:
|
||||
src: "{{ atl_product_temp_download }}"
|
||||
dest: "{{ atl_product_home_shared_download }}"
|
||||
remote_src: true
|
||||
when: moving_lock_created is succeeded
|
||||
register: copied
|
||||
|
||||
- name: Create downloaded_lock once product installer downloaded and copied
|
||||
file:
|
||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||
state: directory
|
||||
when: copied is succeeded
|
||||
register: downloaded_lock_created
|
||||
|
||||
- name: Remove moving_lock to show that binary is completed
|
||||
file:
|
||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
state: absent
|
||||
when:
|
||||
- downloaded_lock_created is succeeded
|
||||
- copied is succeeded
|
||||
register: moving_lock_removed
|
||||
|
||||
- name: Delete old temp installer
|
||||
file:
|
||||
path: "{{ atl_product_temp_download }}"
|
||||
state: absent
|
||||
when: moving_lock_removed is succeeded
|
||||
register: temp_deleted
|
||||
|
||||
when: move_binary
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user