mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-19 19:33:07 -06:00
Merge remote-tracking branch 'origin/master' into DCD-798-fix-for-pg_dump-cusstom-format
This commit is contained in:
@@ -8,3 +8,5 @@
|
||||
PYTHON: /bin/python
|
||||
args:
|
||||
creates: /usr/bin/psql
|
||||
environment:
|
||||
PYTHON: /bin/python
|
||||
|
||||
44
roles/restore_backups/tasks/home_restore.yml
Normal file
44
roles/restore_backups/tasks/home_restore.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
- 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 }}"
|
||||
|
||||
- name: Restore the shared-home backup
|
||||
unarchive:
|
||||
src: "{{ atl_backup_home_dest }}"
|
||||
remote_src: yes
|
||||
dest: "{{ atl_product_home_shared }}"
|
||||
|
||||
- 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
|
||||
@@ -68,7 +68,9 @@
|
||||
overwrite: different
|
||||
bucket: "{{ atl_backup_manifest.artifacts.db.location.location | urlsplit('hostname') }}"
|
||||
object: "{{ atl_backup_manifest.artifacts.db.location.location | urlsplit('path') }}"
|
||||
dest: "{{ atl_backup_db_dest }}"
|
||||
# We save the backup as a .tar file so that the postgresql_db module uses pg_restore instead of psql to do restore
|
||||
# This can be removed when ansible 2.10 is released
|
||||
dest: "{{ atl_backup_db_dest }}.tar"
|
||||
|
||||
- name: Fetch Home backup from S3
|
||||
aws_s3:
|
||||
@@ -96,42 +98,18 @@
|
||||
template: "{{ atl_jdbc_template }}"
|
||||
# Depends on fetch_backup roles
|
||||
state: restore
|
||||
target: "{{ atl_backup_db_dest }}"
|
||||
target: "{{ atl_backup_db_dest }}.tar"
|
||||
target_opts: "-Fc"
|
||||
register: result
|
||||
# managed DBs in cloud providers are not allowing full root access to the DB engine, we can safely ignore the COMMENT ON EXTENSION error
|
||||
failed_when:
|
||||
- result.rc != 0
|
||||
- "COMMENT ON EXTENSION" not in result.msg
|
||||
- '"COMMENT ON EXTENSION" not in result.msg'
|
||||
when: db_created.changed and atl_backup_db_dest is defined
|
||||
|
||||
|
||||
- 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 }}"
|
||||
|
||||
- name: Restore the shared-home backup
|
||||
unarchive:
|
||||
src: "{{ atl_backup_home_dest }}"
|
||||
dest: "{{ atl_product_home_shared }}"
|
||||
owner: "{{ atl_product_user }}"
|
||||
group: "{{ atl_product_user }}"
|
||||
|
||||
- name: Create restore-canary if necessary
|
||||
copy:
|
||||
dest: "{{ atl_backup_home_restore_canary_path }}"
|
||||
content: "{{ atl_backup_id }}"
|
||||
|
||||
when: not restore_canary.stat.exists
|
||||
- name: Restore shared home
|
||||
include_tasks: "home_restore.yml"
|
||||
|
||||
|
||||
when: atl_restore_required
|
||||
|
||||
Reference in New Issue
Block a user