-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrestore_AAP_backup.yml
58 lines (52 loc) · 2.11 KB
/
restore_AAP_backup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
- name: restore postgres backup database to automation controller
hosts: aap_demo_controller
vars:
backup_tar_url: 'https://www.dropbox.com/scl/fi/x2ai7dzbtkclowvjoqt6x/ac_backup2023-10-25_version_2.4-1.tar.gz?rlkey=ao33mgq52aaszo6gqtk5wj39r&dl=0'
aap_version: '2-4'
rhel_os: "rhel_8"
backup_file_name: ac_backup2023-10-25_version_2.4-1.tar.gz
bundle: "not_bundled" # options "bundled" or "not_bundled"
install_dir: /root/
tasks:
- name: install extraction dependencies
yum:
name:
- wget
state: present
# - name:
# command: wget {{backup_tar_url}}
# args:
# chdir: "{{install_dir}}"
#
# - name:
# command: mv {{}}
- name: download backup from dropbox
ansible.builtin.shell: >
curl -o {{install_dir}}{{backup_file_name}} -X POST https://content.dropboxapi.com/2/files/download
--header "Authorization: Bearer {{access_token}}"
--header "Dropbox-API-Arg: {\"path\":\"/Apps/Automation_Controller/{{backup_file_name}}\"}"
args:
chdir: "{{install_dir}}"
register: backup_file
# curl -X POST https://content.dropboxapi.com/2/files/download
# --header "Authorization: Bearer {{ access_token }}"
# --header "Dropbox-API-Arg: {\"path\": \"/Apps/Automation_Controller/ac_backup{{ backup_file_name }}\"}"
# --header "Content-Type: application/octet-stream"
# --data-binary @automation-platform-backup-latest.tar.gz
## DOWNLOADS HTML
# - name: download backup file
# get_url:
# url: "{{backup_tar_url}}"
# dest: "{{install_dir}}"
# register: backup_file
- name: Run setup.sh with restore option
block:
- name: restore postressql
ansible.builtin.shell: ./setup.sh -e 'restore_backup_file={{install_dir}}{{backup_file_name}}' -r
args:
chdir: "{{install_dir}}/installer-{{aap_version}}-{{bundle}}"
register: restore_output
rescue:
- name: show /var/log/tower/restore...log output
command: cat {{ restore_output.stdout_lines[-1][19:-1] }} | fold -w 120