mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
ITOPSENG-164 Debug some changes to logic
This commit is contained in:
@@ -138,17 +138,11 @@
|
|||||||
move_binary: false
|
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 pre-downloaded binary on shared_home and completed lock dir.
|
||||||
# if it needs to be downloaded again.
|
- name: Check for completed lock directory
|
||||||
- name: Check for moving lock directory
|
|
||||||
stat:
|
stat:
|
||||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
path: "{{ atl_product_home_shared_completed_lock }}"
|
||||||
register: moving_lock
|
register: completed_lock
|
||||||
|
|
||||||
- name: Check for downloaded lock directory
|
|
||||||
stat:
|
|
||||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
|
||||||
register: downloaded_lock
|
|
||||||
|
|
||||||
- name: Check for product installer in home_shared
|
- name: Check for product installer in home_shared
|
||||||
stat:
|
stat:
|
||||||
@@ -162,9 +156,8 @@
|
|||||||
atl_product_download: "{{ atl_product_home_shared_download }}"
|
atl_product_download: "{{ atl_product_home_shared_download }}"
|
||||||
when:
|
when:
|
||||||
- home_shared_download.stat.exists
|
- home_shared_download.stat.exists
|
||||||
- downloaded_lock.stat.isdir is defined
|
- completed_lock.stat.isdir is defined
|
||||||
- downloaded_lock.stat.isdir
|
- completed_lock.stat.isdir
|
||||||
- ( moving_lock.stat.isdir is not defined or moving_lock.stat.isdir == False )
|
|
||||||
|
|
||||||
# If the binary was never installed, download it to temp location
|
# If the binary was never installed, download it to temp location
|
||||||
- name: Installer not on home_shared. Fetch it.
|
- name: Installer not on home_shared. Fetch it.
|
||||||
@@ -173,98 +166,121 @@
|
|||||||
dest: "{{ atl_product_temp_download }}"
|
dest: "{{ atl_product_temp_download }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
force: false
|
force: false
|
||||||
register: atl_product_downloaded
|
register: atl_product_completed
|
||||||
when: download_binary
|
when: download_binary
|
||||||
|
|
||||||
# If product installer was fetched to temp, install from there
|
# If product installer was fetched
|
||||||
# If product installer was pre-downloaded on shared_home, install from there
|
# Make the moving directory
|
||||||
# This is determined by {{ atl_product_download }} variable
|
# - failure, continue and install from temp
|
||||||
- name: Unpack the downloaded application depending on format
|
# - success, move binary and install from shared_home
|
||||||
include_tasks: "unpack_{{ atl_download_format }}.yml"
|
|
||||||
|
|
||||||
- name: Symlink the installed version to current
|
- name: Create moving_lock.
|
||||||
file:
|
file:
|
||||||
src: "{{ atl_product_installation_versioned }}"
|
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
dest: "{{ atl_product_installation_current }}"
|
state: directory
|
||||||
state: link
|
when: download_binary is succeeded
|
||||||
force: true
|
register: moving_lock_created
|
||||||
|
|
||||||
# Temp product was downloaded and installed.
|
- name: Debug Scenario A - lock created
|
||||||
# If the following conditions are true, move to home_shared
|
debug: lock created
|
||||||
# 1. This node just downloaded binary.
|
when: moving_lock_created is succeeded
|
||||||
# 2. Another node is not already moving into place.
|
|
||||||
# 3. The binary is downloaded and lockdir in place.
|
|
||||||
- name: "Check move product installer"
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: Check again for moving lock directory
|
- name: Debug Scenario B - lock cannot created
|
||||||
stat:
|
debug: lock not created
|
||||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
when: moving_lock_created is failed
|
||||||
register: moving_lock_2
|
|
||||||
|
|
||||||
- name: Check again for downloaded lock directory
|
|
||||||
stat:
|
|
||||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
|
||||||
register: downloaded_lock_2
|
# # If product installer was pre-downloaded on shared_home, install from there
|
||||||
|
# # This is determined by {{ atl_product_download }} variable
|
||||||
- name: Check again for product installer in home_shared
|
# - name: Unpack the downloaded application depending on format
|
||||||
stat:
|
# include_tasks: "unpack_{{ atl_download_format }}.yml"
|
||||||
path: "{{ atl_product_home_shared_download }}"
|
|
||||||
register: home_shared_download_2
|
# - name: Symlink the installed version to current
|
||||||
|
# file:
|
||||||
# If binary exists and lockdir exists use this binary instead
|
# src: "{{ atl_product_installation_versioned }}"
|
||||||
- name: Check lock directory and binary exists on shared_home
|
# dest: "{{ atl_product_installation_current }}"
|
||||||
set_fact:
|
# state: link
|
||||||
move_binary: true
|
# force: true
|
||||||
when:
|
|
||||||
- ( home_shared_download.stat.exists == False or
|
# # Temp product was downloaded and installed.
|
||||||
downloaded_lock.stat.isdir is not defined or downloaded_lock.stat.isdir == False )
|
# # If the following conditions are true, move to home_shared
|
||||||
- ( moving_lock.stat.isdir is not defined or moving_lock.stat.isdir == False )
|
# # 1. This node just downloaded binary.
|
||||||
|
# # 2. Another node is not already moving into place.
|
||||||
when: download_binary
|
# # 3. The binary is downloaded and lockdir in place.
|
||||||
|
# - name: "Check move product installer"
|
||||||
- name: "Move product installer if required"
|
# block:
|
||||||
block:
|
|
||||||
|
# - name: Check again for moving lock directory
|
||||||
- name: Create moving_lock to ensure other nodes skip
|
# stat:
|
||||||
file:
|
# path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
# register: moving_lock_2
|
||||||
state: directory
|
|
||||||
when: move_binary
|
# - name: Check again for completed lock directory
|
||||||
register: moving_lock_created
|
# stat:
|
||||||
|
# path: "{{ atl_product_home_shared_completed_lock }}"
|
||||||
- name: Copy temp installer to home_shared
|
# register: completed_lock_2
|
||||||
copy:
|
|
||||||
src: "{{ atl_product_temp_download }}"
|
# - name: Check again for product installer in home_shared
|
||||||
dest: "{{ atl_product_home_shared_download }}"
|
# stat:
|
||||||
remote_src: true
|
# path: "{{ atl_product_home_shared_download }}"
|
||||||
when: moving_lock_created is succeeded
|
# register: home_shared_download_2
|
||||||
register: copied
|
|
||||||
|
# # If binary exists and lockdir exists use this binary instead
|
||||||
- name: Create downloaded_lock once product installer downloaded and copied
|
# - name: Check lock directory and binary exists on shared_home
|
||||||
file:
|
# set_fact:
|
||||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
# move_binary: true
|
||||||
state: directory
|
# when:
|
||||||
when: copied is succeeded
|
# - ( home_shared_download.stat.exists == False or
|
||||||
register: downloaded_lock_created
|
# completed_lock.stat.isdir is not defined or completed_lock.stat.isdir == False )
|
||||||
|
# - ( moving_lock.stat.isdir is not defined or moving_lock.stat.isdir == False )
|
||||||
- name: Remove moving_lock to show that binary is completed
|
|
||||||
file:
|
# when: download_binary
|
||||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
|
||||||
state: absent
|
# - name: "Move product installer if required"
|
||||||
when:
|
# block:
|
||||||
- downloaded_lock_created is succeeded
|
|
||||||
- copied is succeeded
|
# - name: Create moving_lock to ensure other nodes skip
|
||||||
register: moving_lock_removed
|
# file:
|
||||||
|
# path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
- name: Delete old temp installer
|
# state: directory
|
||||||
file:
|
# when: move_binary
|
||||||
path: "{{ atl_product_temp_download }}"
|
# register: moving_lock_created
|
||||||
state: absent
|
|
||||||
when: moving_lock_removed is succeeded
|
# - name: Copy temp installer to home_shared
|
||||||
register: temp_deleted
|
# copy:
|
||||||
|
# src: "{{ atl_product_temp_download }}"
|
||||||
when: move_binary
|
# dest: "{{ atl_product_home_shared_download }}"
|
||||||
|
# remote_src: true
|
||||||
|
# when: moving_lock_created is succeeded
|
||||||
|
# register: copied
|
||||||
|
|
||||||
|
# - name: Create completed_lock once product installer downloaded and copied
|
||||||
|
# file:
|
||||||
|
# path: "{{ atl_product_home_shared_completed_lock }}"
|
||||||
|
# state: directory
|
||||||
|
# when: copied is succeeded
|
||||||
|
# register: completed_lock_created
|
||||||
|
|
||||||
|
# - name: Remove moving_lock to show that binary is completed
|
||||||
|
# file:
|
||||||
|
# path: "{{ atl_product_home_shared_moving_lock }}"
|
||||||
|
# state: absent
|
||||||
|
# when:
|
||||||
|
# - completed_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