Intial Commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
- name: Recovery from original instance outage
|
||||
hosts: DR
|
||||
tasks:
|
||||
- include_vars: ./vault/restic/restic.yml
|
||||
- name: Create folder
|
||||
ansible.builtin.file:
|
||||
path: ~/docker
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Pull backups
|
||||
shell: |
|
||||
unset HISTFILE
|
||||
export RESTIC_REPOSITORY={{ RESTIC_REPOSITORY }}
|
||||
export AWS_ACCESS_KEY_ID={{ AWS_ACCESS_KEY_ID }}
|
||||
export AWS_SECRET_ACCESS_KEY={{ AWS_SECRET_ACCESS_KEY }}
|
||||
export RESTIC_PASSWORD={{ RESTIC_PASSWORD }}
|
||||
cd ~/docker
|
||||
restic restore latest:/source/gcloud --target ./
|
||||
|
||||
- name: Start container using Docker Compose
|
||||
ansible.builtin.command:
|
||||
cmd: docker compose up -d
|
||||
chdir: ~/docker
|
||||
ignore_errors: true
|
||||
|
||||
- name: Pause for 30 seconds to allow containers to stabilize
|
||||
ansible.builtin.pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Check container status
|
||||
ansible.builtin.shell: docker compose ps -q | xargs -n1 docker container inspect --format '{{ "{{" }} .State.Running {{ "}}" }}'
|
||||
args:
|
||||
chdir: ~/docker
|
||||
register: container_status
|
||||
ignore_errors: true
|
||||
Reference in New Issue
Block a user