mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43: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
|
# shared home to ensure all subsequent nodes have access
|
||||||
# to the same specific version binary.
|
# to the same specific version binary.
|
||||||
# To prevent a race condition with multiple downloads at the same time
|
# 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:
|
set_fact:
|
||||||
download_binary: true
|
download_binary: true
|
||||||
|
move_binary: false
|
||||||
atl_product_download: "{{ atl_product_temp_download }}"
|
atl_product_download: "{{ atl_product_temp_download }}"
|
||||||
|
|
||||||
# Check for product installer in home_shared and lockdir to determine
|
# Check for product installer in home_shared and lockdir to determine
|
||||||
# if it needs to be downloaded again.
|
# if it needs to be downloaded again.
|
||||||
- name: Check moving lock directory does not exist
|
- name: Check for moving lock directory
|
||||||
stat:
|
stat:
|
||||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
register: moving_lock
|
register: moving_lock
|
||||||
|
|
||||||
- name: Check downloaded lock directory exists
|
- name: Check for downloaded lock directory
|
||||||
stat:
|
stat:
|
||||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||||
register: downloaded_lock
|
register: downloaded_lock
|
||||||
|
|
||||||
- name: Check for presence of product installer in home_shared
|
- name: Check for product installer in home_shared
|
||||||
stat:
|
stat:
|
||||||
path: "{{ atl_product_home_shared_download }}"
|
path: "{{ atl_product_home_shared_download }}"
|
||||||
register: home_shared_download
|
register: home_shared_download
|
||||||
@@ -188,60 +189,76 @@
|
|||||||
state: link
|
state: link
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
# # Product is installed. If the following are true, move to home_shared
|
# Product is installed. If the following are true, move to home_shared
|
||||||
# # 1. This node just downloaded binary.
|
# 1. This node just downloaded binary.
|
||||||
# # 2. Another node is not already moving into place.
|
# 2. Another node is not already moving into place.
|
||||||
# - name: "Move product installer"
|
- name: "Move product installer"
|
||||||
# block:
|
block:
|
||||||
|
|
||||||
# - name: Check moving lock directory does not exist
|
- name: Check again for moving lock directory
|
||||||
# stat:
|
stat:
|
||||||
# path: "{{ atl_product_home_shared_moving_lock }}"
|
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
# register: moving_lock
|
register: moving_lock_2
|
||||||
|
|
||||||
# - name: Check downloaded lock directory exists
|
- name: Check again for downloaded lock directory
|
||||||
# stat:
|
stat:
|
||||||
# path: "{{ atl_product_home_shared_downloaded_lock }}"
|
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||||
# register: downloaded_lock
|
register: downloaded_lock_2
|
||||||
|
|
||||||
# - name: Check for presence of product installer in home_shared
|
- name: Check again for product installer in home_shared
|
||||||
# stat:
|
stat:
|
||||||
# path: "{{ atl_product_home_shared_download }}"
|
path: "{{ atl_product_home_shared_download }}"
|
||||||
# register: 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:
|
||||||
# - name: Remove lockdir to prevent nodes relying on binary when copying
|
- home_shared_download.stat.exists == False
|
||||||
# file:
|
- ( downloaded_lock.stat.isdir is not defined or downloaded_lock.stat.isdir == False )
|
||||||
# path: "{{ atl_product_home_shared_download_lockdir }}"
|
- ( moving_lock.stat.isdir is not defined or moving_lock.stat.isdir == False )
|
||||||
# state: absent
|
|
||||||
# when: atl_product_downloaded is succeeded
|
- name: Create moving_lock to ensure other nodes skip
|
||||||
# register: lockdir_removed
|
file:
|
||||||
|
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
# - name: Copy temp installer to home_shared
|
state: directory
|
||||||
# copy:
|
when: move_binary
|
||||||
# src: "{{ atl_product_download }}"
|
register: moving_lock_created
|
||||||
# dest: "{{ atl_product_home_shared_download }}"
|
|
||||||
# remote_src: true
|
- name: Copy temp installer to home_shared
|
||||||
# when: lockdir_removed is succeeded
|
copy:
|
||||||
# register: copied
|
src: "{{ atl_product_temp_download }}"
|
||||||
|
dest: "{{ atl_product_home_shared_download }}"
|
||||||
# - name: Delete old temp installer
|
remote_src: true
|
||||||
# file:
|
when: moving_lock_created is succeeded
|
||||||
# path: "{{ atl_product_download }}"
|
register: copied
|
||||||
# state: absent
|
|
||||||
# when: copied is succeeded
|
- name: Create downloaded_lock once product installer downloaded and copied
|
||||||
# register: temp_deleted
|
file:
|
||||||
|
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||||
# - name: Create lockdir once product installer downloaded and moved
|
state: directory
|
||||||
# file:
|
when: copied is succeeded
|
||||||
# path: "{{ atl_product_home_shared_download_lockdir }}"
|
register: downloaded_lock_created
|
||||||
# state: directory
|
|
||||||
# when: temp_deleted is succeeded
|
- 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