fix: restore command now seperated

This commit is contained in:
2025-02-11 21:18:55 -05:00
parent f7a0a3e868
commit 116c683300
11 changed files with 77 additions and 37 deletions

View File

@@ -1,9 +1,10 @@
- name: Deploy artifact to instance.
hosts: localhost
become: true
gather_facts: false
vars_files:
- ../config/ansible.json
- ../config/infrastructure.json
- ../config/ansible.secret.json
- ../config/infrastructure.secret.tf.json
vars:
ansible_connection: aws_ssm
ansible_python_interpreter: /usr/bin/python3
@@ -27,23 +28,38 @@
access_key: "{{ boot_id.value }}"
secret_key: "{{ boot_secret.value }}"
amazon.aws.s3_object:
bucket: "{{ boot_bucket }}"
object: "{{ boot_key }}"
dest: /home/ssm-user/backup.tar.xz
bucket: "{{ restore_bucket | mandatory(msg='You must specify the bucket of the data.') }}"
object: "{{ restore_key | mandatory(msg='You must specify the key of the data.') }}"
dest: /home/ssm-user/backup.tar.gz
mode: get
- name: Ensure backup directory exists.
ansible.builtin.file:
path: /home/ssm-user/data
path: /home/ssm-user/backup
state: directory
mode: '0777'
- name: Extract backup.
ansible.builtin.unarchive:
src: /home/ssm-user/backup.tar.xz
dest: /home/ssm-user/data
src: /home/ssm-user/backup.tar.gz
dest: /home/ssm-user/backup
remote_src: true
- name: Move backup files to data folder.
ansible.builtin.copy:
remote_src: true
src: /home/ssm-user/backup/backup/my-app-backup/
dest: /home/ssm-user/data/
mode: '0777'
- name: Update permissions.
ansible.builtin.file:
path: /home/ssm-user/data
recurse: true
mode: '0777'
owner: 1000
group: 1000
- name: Restart containers.
community.docker.docker_container:
name: "{{ item }}"