Files
git/playbooks/restore.yml
M.V. Hutz 4b4bdc301e chore: normalize quote style in playbooks (#9)
## Summary
- Standardize single quotes to double quotes across deploy, destroy, provision, and restore playbooks

## Test plan
- No functional changes — formatting only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #9
Co-authored-by: M.V. Hutz <git@maximhutz.me>
Co-committed-by: M.V. Hutz <git@maximhutz.me>
2026-03-16 02:54:11 +00:00

74 lines
2.1 KiB
YAML

- name: Set up real host.
gather_facts: false
hosts: localhost
vars_files:
- ../vault.yml
- ../dist/terraform_outputs.yml
tasks:
- name: Add remote host.
ansible.builtin.add_host:
name: server
ansible_ssh_host: "{{ server_ip.value }}"
ansible_user: root
ansible_port: 2222
ansible_private_key_file: "{{ secret.private_ssh_key_path }}"
- name: Deploy artifact to instance.
hosts: server
become: true
gather_facts: false
vars_files:
- ../vault.yml
- ../dist/terraform_outputs.yml
tasks:
- name: Stop server.
community.docker.docker_container:
name: "{{ item }}"
state: stopped
loop: [server, backup]
- name: Copy backup from S3.
amazon.aws.s3_object:
bucket: "{{ secret.restore.bucket | mandatory(msg='You must specify the bucket of the data.') }}"
object: "{{ secret.restore.key | mandatory(msg='You must specify the key of the data.') }}"
dest: /root/snapshot.tar.gz
mode: get
region: "{{ secret.restore.region }}"
access_key: "{{ secret.restore.access_key }}"
secret_key: "{{ secret.restore.secret_key }}"
endpoint_url: "{{ secret.restore.endpoint | mandatory(msg='You must specify the S3 URL.') }}"
ignore_nonexistent_bucket: true
- name: Ensure backup directory exists.
ansible.builtin.file:
path: /root/restore
state: directory
mode: "0777"
- name: Extract backup.
ansible.builtin.unarchive:
src: /root/snapshot.tar.gz
dest: /root/restore
remote_src: true
- name: Move backup files to data folder.
ansible.builtin.copy:
remote_src: true
src: /root/restore/backup/my-app-backup/
dest: /root/data/
mode: "0777"
- name: Update permissions.
ansible.builtin.file:
path: /root/data
recurse: true
mode: "0777"
owner: 1000
group: 1000
- name: Restart containers.
community.docker.docker_container:
name: "{{ item }}"
state: started
loop: [server, backup]