mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
76 lines
2.4 KiB
YAML
76 lines
2.4 KiB
YAML
---
|
|
- name: Check for the restore canary file
|
|
stat:
|
|
path: "{{ atl_backup_home_restore_canary_path }}"
|
|
register: restore_canary
|
|
|
|
- block:
|
|
- name: Create shared home if necessary
|
|
file:
|
|
path: "{{ atl_product_home_shared }}"
|
|
state: directory
|
|
mode: 0750
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
|
|
# We also need to use `tar` here as `unarchive` runs `tar` three times doing
|
|
# idempotence checks, which we can skip.
|
|
- name: Restore the shared-home backup
|
|
command:
|
|
argv:
|
|
- "tar"
|
|
- "--extract"
|
|
- "--file"
|
|
- "{{ atl_backup_home_dest }}"
|
|
- "--directory"
|
|
- "{{ atl_product_home_shared }}"
|
|
warn: false
|
|
when: atl_backup_home_is_server is not defined or not atl_backup_home_is_server|bool
|
|
|
|
# Use tar transform to convert the Confluence Server (unclustered)
|
|
# layout to shared-home version. What occurs is:
|
|
#
|
|
# * --transform runs first, moving attachments into the shared home.
|
|
# * --strip-components removes the top-level directory
|
|
#
|
|
# NOTE: Also see the `confluence_config` role, which uses
|
|
# symlinks to support server and clustered layouts
|
|
# concurrently.
|
|
- name: Restore a Confluence server home to share-home layout
|
|
command:
|
|
argv:
|
|
- "tar"
|
|
- "--extract"
|
|
- "--transform=s,^attachments,shared-home/attachments,"
|
|
- "--strip-components=1"
|
|
- "--file"
|
|
- "{{ atl_backup_home_dest }}"
|
|
- "--directory"
|
|
- "{{ atl_product_home_shared }}"
|
|
warn: false
|
|
when: atl_backup_home_is_server is defined and atl_backup_home_is_server|bool
|
|
|
|
- name: Set shared home owner and group to application user
|
|
file:
|
|
path: "{{ atl_product_home_shared }}"
|
|
recurse: yes
|
|
group: "{{ atl_product_user }}"
|
|
owner: "{{ atl_product_user }}"
|
|
state: directory
|
|
|
|
- name: Set version file owner and group to root
|
|
file:
|
|
path: "{{ atl_product_version_cache }}"
|
|
group: root
|
|
owner: root
|
|
state: file
|
|
# Ignore the error in case there is no product version file in the backup
|
|
ignore_errors: yes
|
|
|
|
- name: Create restore-canary if necessary
|
|
copy:
|
|
dest: "{{ atl_backup_home_restore_canary_path }}"
|
|
content: "{{ atl_backup_id }}"
|
|
|
|
when: not restore_canary.stat.exists
|