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:
@@ -19,12 +19,13 @@ atl_product_base_url: "{{ atl_release_base_url }}/{{ atl_product_family }}/downl
|
||||
atl_product_download_url: "{{ atl_product_base_url }}/atlassian-{{ atl_download_edition | default(atl_product_edition) }}-{{ atl_product_version }}{{ atl_download_suffix }}"
|
||||
|
||||
atl_product_download_filename: "{{ atl_download_edition | default(atl_product_edition) }}.{{ atl_product_version }}{{ atl_download_suffix }}"
|
||||
atl_product_download: "{{ atl_installer_temp }}/{{ atl_product_download_filename }}"
|
||||
atl_product_temp_download: "{{ atl_installer_temp }}/{{ atl_product_download_filename }}"
|
||||
atl_product_varfile: "{{ atl_installer_temp }}/{{ atl_product_family }}.varfile"
|
||||
|
||||
atl_product_home_shared_download_dir: "{{ atl_product_home_shared }}/downloads"
|
||||
atl_product_home_shared_download: "{{ atl_product_home_shared_download_dir }}/{{ atl_product_download_filename }}"
|
||||
atl_product_home_shared_download_lockdir: "{{ atl_product_home_shared_download }}_downloaded"
|
||||
atl_product_home_shared_lockdir_moving: "{{ atl_product_home_shared_download }}_moving"
|
||||
atl_product_home_shared_lockdir_downloaded: "{{ atl_product_home_shared_download }}_downloaded"
|
||||
|
||||
atl_marketplace_base: "https://marketplace.atlassian.com"
|
||||
atl_servicedesk_latest_url: "https://marketplace.atlassian.com/rest/2/products/key/jira-servicedesk/versions/latest"
|
||||
|
||||
@@ -132,73 +132,52 @@
|
||||
# To prevent a race condition with multiple downloads at the same time
|
||||
# a directory is used as a lockfile (atomic operation).
|
||||
|
||||
- name: Assume temp binary should be downloaded
|
||||
- name: Assume temp binary should be downloaded and used
|
||||
set_fact:
|
||||
download_binary: true
|
||||
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 download lock directory exists
|
||||
- name: Check moving lock directory does not exist
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_download_lockdir }}"
|
||||
register: download_lockdir
|
||||
path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
register: moving_lock
|
||||
|
||||
- name: Check downloaded lock directory exists
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||
register: downloaded_lock
|
||||
|
||||
- name: Check for presence of product installer in home_shared
|
||||
stat:
|
||||
path: "{{ atl_product_home_shared_download }}"
|
||||
register: home_shared_downloaded
|
||||
register: home_shared_download
|
||||
|
||||
# If binary exists and lockdir exists use this binary instead
|
||||
- name: Check Lock Directory and binary exists on shared_home
|
||||
- name: Check lock directory and binary exists on shared_home
|
||||
set_fact:
|
||||
download_binary: false
|
||||
atl_product_download: "{{ atl_product_home_shared_download }}"
|
||||
when:
|
||||
- home_shared_downloaded.stat.exists
|
||||
- download_lockdir.stat.isdir is defined
|
||||
- download_lockdir.stat.isdir
|
||||
|
||||
# If the binary was never installed, download it
|
||||
- name: "Download product installer and move to shared directory"
|
||||
block:
|
||||
|
||||
- name: Fetch product installer
|
||||
get_url:
|
||||
url: "{{ atl_product_download_url }}"
|
||||
dest: "{{ atl_product_download }}"
|
||||
mode: 0755
|
||||
force: false
|
||||
register: atl_product_downloaded
|
||||
|
||||
- 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
|
||||
- home_shared_download.stat.exists
|
||||
- downloaded_lock.stat.isdir is defined
|
||||
- downloaded_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
|
||||
- name: Installer not on home_shared. Fetch it.
|
||||
get_url:
|
||||
url: "{{ atl_product_download_url }}"
|
||||
dest: "{{ atl_product_temp_download }}"
|
||||
mode: 0755
|
||||
force: false
|
||||
register: atl_product_downloaded
|
||||
when: download_binary
|
||||
|
||||
# If product installer was fetched to temp, install from there
|
||||
# If product installer was pre-downloaded on shared_home, install from there
|
||||
# This is determined by {{ atl_product_download }} variable
|
||||
- name: Unpack the downloaded application depending on format
|
||||
include_tasks: "unpack_{{ atl_download_format }}.yml"
|
||||
|
||||
@@ -208,3 +187,62 @@
|
||||
dest: "{{ atl_product_installation_current }}"
|
||||
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:
|
||||
|
||||
# - name: Check moving lock directory does not exist
|
||||
# stat:
|
||||
# path: "{{ atl_product_home_shared_moving_lock }}"
|
||||
# register: moving_lock
|
||||
|
||||
# - name: Check downloaded lock directory exists
|
||||
# stat:
|
||||
# path: "{{ atl_product_home_shared_downloaded_lock }}"
|
||||
# register: downloaded_lock
|
||||
|
||||
# - 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
# actions. For example, if root and the 'jira' user exists then it
|
||||
# will create 'jira1'; this potentially creates idempotency/upgrade
|
||||
# issues down the line.
|
||||
# The variable {{ atl_product_download }} will be on temp for first nodes and shared_home for
|
||||
# subsequent nodes.
|
||||
- name: Run the installer
|
||||
command: /bin/sh "{{ atl_product_home_shared_download }}" -q -varfile "{{ atl_product_varfile }}"
|
||||
command: /bin/sh "{{ atl_product_download }}" -q -varfile "{{ atl_product_varfile }}"
|
||||
args:
|
||||
creates: "{{ atl_product_installation_versioned }}/.install4j/"
|
||||
become: true
|
||||
|
||||
Reference in New Issue
Block a user