feat: gitea now standalone
This commit is contained in:
51
playbooks/restore.yml
Normal file
51
playbooks/restore.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
- name: Deploy artifact to instance.
|
||||
hosts: localhost
|
||||
become: true
|
||||
vars_files:
|
||||
- ../secrets/gitea.json
|
||||
- ../secrets.tf.json
|
||||
vars:
|
||||
ansible_connection: aws_ssm
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_aws_ssm_plugin: "{{ ssm_plugin }}"
|
||||
ansible_aws_ssm_bucket_name: "{{ image_bucket }}"
|
||||
ansible_aws_ssm_instance_id: "{{ instance_id.value }}"
|
||||
|
||||
ansible_aws_ssm_region: "{{ aws_region }}"
|
||||
ansible_aws_ssm_access_key_id: "{{ aws_access_key }}"
|
||||
ansible_aws_ssm_secret_access_key: "{{ aws_secret_key }}"
|
||||
tasks:
|
||||
- name: Stop server.
|
||||
community.docker.docker_container:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
loop: [server, backup]
|
||||
|
||||
- name: Copy backup from S3.
|
||||
environment:
|
||||
region: "{{ boot_region.value }}"
|
||||
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
|
||||
mode: get
|
||||
|
||||
- name: Ensure backup directory exists.
|
||||
ansible.builtin.file:
|
||||
path: /home/ssm-user/data
|
||||
state: directory
|
||||
mode: '0777'
|
||||
|
||||
- name: Extract backup.
|
||||
ansible.builtin.unarchive:
|
||||
src: /home/ssm-user/backup.tar.xz
|
||||
dest: /home/ssm-user/data
|
||||
remote_src: true
|
||||
|
||||
- name: Restart containers.
|
||||
community.docker.docker_container:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
loop: [server, backup]
|
||||
Reference in New Issue
Block a user