DCD-224: Rename product_download to tgz_download in prep for an alternative installer.

This commit is contained in:
Steve Smith
2019-05-07 15:37:41 +10:00
parent b98a485fa8
commit 9b9860a5ef
49 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,21 @@
---
- name: Check for existing version cache file
stat:
path: "{{ atl_product_version_cache }}"
register: cached
# Case: File exists, always use its value
- name: Use version for product version
block:
- name: Read cached version from file
command: "cat {{ atl_product_version_cache }}"
register: atl_product_version_file
changed_when: false
- name: Set the local var to cached version
set_fact:
atl_product_version: "{{ atl_product_version_file.stdout }}"
when: cached.stat.exists

View File

@@ -0,0 +1,8 @@
---
# At this point atl_product_version should be set, cache if necessary.
- name: Write override cached version when specified
template:
src: version.j2
dest: "{{ atl_product_version_cache }}"
force: false

View File

@@ -0,0 +1,38 @@
---
# Note: We don't the cache binary in the shared drive to the complexity
# around download race-conditions if multiple nodes are starting at
# the same time. When downloading from product-downloads.atlassian.com
# (which is a CDN) takes seconds anyway.
- name: Fetch product installer
get_url:
url: "{{ atl_product_download_url }}"
dest: "{{ atl_product_download }}"
mode: 0644
force: false
- name: Create target version directory
file:
path: "{{ atl_product_installation_base }}/{{ atl_product_version }}"
state: directory
owner: "{{ atl_product_user }}"
- name: Unpack the product packages
unarchive:
remote_src: true
src: "{{ atl_product_download }}"
dest: "{{ atl_product_installation_base }}/{{ atl_product_version }}"
creates: "{{ atl_product_installation_base }}/{{ atl_product_version }}/bin/catalina.sh"
owner: "{{ atl_product_user }}"
group: "{{ atl_product_user }}"
mode: 0755
# Strip off the lead product/version specific directory to normaise naming
extra_opts:
- "--strip-components=1"
- name: Symlink the installed version to current
file:
src: "{{ atl_product_installation_base }}/{{ atl_product_version }}"
dest: "{{ atl_product_installation_target }}"
state: link
force: true

View File

@@ -0,0 +1,13 @@
---
# Common case for most products and Jira editions.
- name: Fetch ServiceDesk metadata if necessary
include_tasks: "servicedesk_download.yml"
when: atl_product_edition == "jira-servicedesk"
# Differences for ServiceDesk become fiddly enough that it's better to
# just split them out and move common functionality into individual
# task files.
- name: Fetch product metadata if necessary
include_tasks: "product_download.yml"
when: atl_product_edition != "jira-servicedesk"

View File

@@ -0,0 +1,31 @@
---
- name: Check for and load cached version
include_tasks: "cached_version_fetch.yml"
# Case: File doesn't exist and no version has been set; find latest.
- name: Fetch and cache latest version when no override
block:
- name: Fetch the latest version from URL
set_fact:
atl_product_version_json: "{{ lookup('url', '{{ atl_product_latest_version_url }}') }}"
- name: Set the local var to retrieved version
set_fact:
atl_product_version: "{{ atl_product_version_json.version }}"
when:
not cached.stat.exists and
(atl_product_version is undefined or
not atl_product_version or
atl_product_version == "latest")
- name: Cache download version if necessary
include_tasks: "cached_version_write.yml"
- name: Fetch and unpack the product distribution
include_tasks: "fetch_product.yml"

View File

@@ -0,0 +1,71 @@
---
- name: Check for and load cached version
include_tasks: "cached_version_fetch.yml"
# Case: File doesn't exist and no version has been set; find latest.
- name: Fetch and cache latest version when no override
block:
- name: Fetch the ServiceDesk metadata from marketplace
set_fact:
atl_servicedesk_version_json: "{{ lookup('url', '{{ atl_servicedesk_latest_url }}') }}"
- name: Set the Jira version for ServiceDesk
set_fact:
atl_product_version: "{{ atl_servicedesk_version_json.name }}"
atl_download_version: "{{ atl_servicedesk_version_json.name }}"
when:
not cached.stat.exists and
(atl_product_version is undefined or
not atl_product_version or
atl_product_version == "latest")
- name: Cache download version if necessary
include_tasks: "cached_version_write.yml"
# We now have a ServiceDesk version, fetch the metadata to give us the
# download URL and Jira versioning information.
- name: Fetch the ServiceDesk metadata from marketplace
set_fact:
atl_servicedesk_version_json: "{{ lookup('url', '{{ atl_servicedesk_versioned_url }}') }}"
- name: Extract the version and download information from the ServiceDesk metadata
set_fact:
atl_download_edition: "jira-software"
atl_download_version: "{{ atl_servicedesk_version_json.compatibilities[0].hosting.server.max.version }}"
atl_servicedesk_download_url: "{{ atl_servicedesk_version_json._embedded.artifact._links.binary.href }}"
- name: Fetch and unpack the Jira edition
include_tasks: "fetch_product.yml"
# FIXME: The following is a bit of a special-case for now; ideally we
# should convert this into a general plugin-installation role
# (esp. when we get to supporting Portfolio), but there's no use for ATM.
- name: Download ServiceDesk
get_url:
url: "{{ atl_servicedesk_download_url }}"
dest: "{{ atl_servicedesk_download_file }}"
mode: 0640
force: false
- name: Extract the plugin to the shared plugin directory
command: /usr/bin/unzip -jn "{{ atl_servicedesk_download_file }}" "*.jar"
args:
chdir: "{{ atl_product_shared_plugins }}"
creates: "{{ atl_product_shared_plugins }}/*servicedesk*.jar"
warn: false
- name: Make plugins writable by the Jira user
file:
path: "{{ atl_product_shared_plugins }}"
owner: "{{ atl_product_user }}"
group: "{{ atl_product_user }}"
mode: 0750
recurse: true