From b17ec2d236230c5a5b5f74d0e9b94f7d1377c791 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Tue, 17 Dec 2019 12:02:52 +1100 Subject: [PATCH] DCD-861: Use native tar rather than unarchive to avoid unnecessary idempotence checks with large archives. --- roles/restore_backups/tasks/home_restore.yml | 45 +++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/roles/restore_backups/tasks/home_restore.yml b/roles/restore_backups/tasks/home_restore.yml index 5c0b7b4..3415231 100644 --- a/roles/restore_backups/tasks/home_restore.yml +++ b/roles/restore_backups/tasks/home_restore.yml @@ -13,28 +13,41 @@ 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 - unarchive: - src: "{{ atl_backup_home_dest }}" - remote_src: yes - dest: "{{ atl_product_home_shared }}" + 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 - unarchive: - 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. - # * --strip-components removes the top-level directory - # NOTE: Also see the `confluence_config` role, which uses - # symlinks to support server and clustered layouts - # concurrently. - extra_opts: + 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