Merged in DCD-861-optimise-home-restore (pull request #60)

DCD-861: Use native tar rather than unarchive to avoid unnecessary idempotence checks with large archives.

Approved-by: Ben Partridge <bpartridge@atlassian.com>
Approved-by: Varun Arbatti <varbatti@atlassian.com>
This commit is contained in:
Steve Smith
2019-12-17 03:18:11 +00:00

View File

@@ -13,28 +13,41 @@
owner: "{{ atl_product_user }}" owner: "{{ atl_product_user }}"
group: "{{ 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 - name: Restore the shared-home backup
unarchive: command:
src: "{{ atl_backup_home_dest }}" argv:
remote_src: yes - "tar"
dest: "{{ atl_product_home_shared }}" - "--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 when: atl_backup_home_is_server is not defined or not atl_backup_home_is_server|bool
- name: Restore a Confluence server home to share-home layout # Use tar transform to convert the Confluence Server (unclustered)
unarchive: # layout to shared-home version. What occurs is:
src: "{{ atl_backup_home_dest }}" #
remote_src: yes
dest: "{{ atl_product_home_shared }}"
# 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. # * --transform runs first, moving attachments into the shared home.
# * --strip-components removes the top-level directory # * --strip-components removes the top-level directory
#
# NOTE: Also see the `confluence_config` role, which uses # NOTE: Also see the `confluence_config` role, which uses
# symlinks to support server and clustered layouts # symlinks to support server and clustered layouts
# concurrently. # concurrently.
extra_opts: - name: Restore a Confluence server home to share-home layout
command:
argv:
- "tar"
- "--extract"
- "--transform=s,^attachments,shared-home/attachments," - "--transform=s,^attachments,shared-home/attachments,"
- "--strip-components=1" - "--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 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 - name: Set shared home owner and group to application user