mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
78 lines
2.9 KiB
YAML
78 lines
2.9 KiB
YAML
---
|
|
|
|
# This role will attempt to fetch and load the backup manifest from a
|
|
# remote HTTP or S3 URL. On successful completion the contents of JSON
|
|
# or YAML document will be in the var `atl_backup_manifest`.
|
|
|
|
- block:
|
|
|
|
- name: Ensure temp directory is present
|
|
file:
|
|
path: "{{ atl_installer_temp }}"
|
|
state: directory
|
|
mode: 0750
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Parse the manifest URL
|
|
set_fact:
|
|
atl_backup_manifest_url: "{{ atl_backup_manifest_url | urlsplit }}"
|
|
|
|
- name: Extract manifest file information
|
|
set_fact:
|
|
atl_backup_manifest_bucket: "{{ atl_backup_manifest_url.hostname }}"
|
|
atl_backup_manifest_path: "{{ atl_backup_manifest_url.path }}"
|
|
atl_backup_manifest_dest: "{{ atl_installer_temp }}/{{ atl_backup_manifest_url.path | basename }}"
|
|
|
|
- name: Fetch the manifest from S3
|
|
aws_s3:
|
|
mode: get
|
|
overwrite: different
|
|
bucket: "{{ atl_backup_manifest_bucket }}"
|
|
object: "{{ atl_backup_manifest_path }}"
|
|
dest: "{{ atl_backup_manifest_dest }}"
|
|
when: atl_backup_manifest_url.scheme == 's3'
|
|
|
|
- name: Fetch the manifest from remote host
|
|
get_url:
|
|
url: "{{ atl_backup_manifest_url }}"
|
|
dest: "{{ atl_backup_manifest_dest }}"
|
|
when: atl_backup_manifest_url.scheme != 's3'
|
|
|
|
# FIXME: The manifest format is still undecided; everything
|
|
# referencing this variable should be considered a placeholder.
|
|
- name: Load parameters from manifest
|
|
include_vars:
|
|
file: "{{ atl_backup_manifest_dest }}"
|
|
name: atl_backup_manifest
|
|
|
|
- name: Define the DB and home dump destinations
|
|
set_fact:
|
|
atl_backup_db_dest: "{{ atl_installer_temp }}/{{ atl_backup_manifest.db_dump | basename }}"
|
|
atl_backup_home_dest: "{{ atl_installer_temp }}/{{ atl_backup_manifest.shared_home_dump | basename }}"
|
|
|
|
# FIXME: Here we fetch the backups. However we may wish to stream
|
|
# these directly from S3 to the target DB/FS to avoid requiring
|
|
# disk-space for the intermediate files.
|
|
- name: Fetch DB backup from S3
|
|
aws_s3:
|
|
mode: get
|
|
overwrite: different
|
|
bucket: "{{ atl_backup_manifest.db_dump | urlsplit('hostname') }}"
|
|
object: "{{ atl_backup_manifest.db_dump | urlsplit('path') }}"
|
|
dest: "{{ atl_backup_db_dest }}"
|
|
|
|
- name: Fetch Home backup from S3
|
|
aws_s3:
|
|
mode: get
|
|
overwrite: different
|
|
bucket: "{{ atl_backup_manifest.shared_home_dump | urlsplit('hostname') }}"
|
|
object: "{{ atl_backup_manifest.shared_home_dump | urlsplit('path') }}"
|
|
dest: "{{ atl_backup_home_dest }}"
|
|
|
|
- name: Install distro-specific restore support packages
|
|
include_tasks: "{{ ansible_distribution|lower }}.yml"
|
|
|
|
when: atl_backup_manifest_url is defined and atl_backup_manifest_url != ''
|