42 lines
1.8 KiB
YAML
42 lines
1.8 KiB
YAML
- name: Rebuild OCI Stack
|
|
hosts: Docker
|
|
tasks:
|
|
- name: Create folder
|
|
ansible.builtin.file:
|
|
path: ~/OCI_Build/docker
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Pull backups
|
|
shell: |
|
|
unset HISTFILE
|
|
export RESTIC_REPOSITORY="s3:idnfqwbge7v2.compat.objectstorage.us-ashburn-1.oraclecloud.com/madereddy-docker-backup"
|
|
export AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID: !vault |
|
|
$ANSIBLE_VAULT;1.1;AES256
|
|
34653331666465383435653635316263653439313062643361633234383866386439386561666331
|
|
3830653163303134623166653630386431636233633730310a653030653830333339663837383438
|
|
62656432373463313765646636323839386266613063653637323439316130613137653465633932
|
|
6232643332356132380a316633386365393433313633343064383466386337333337646534376439
|
|
30653235383837383761326261633438323865383133313132393965313236326662396236373464
|
|
6234333236613664653933343061353032653861393834646662
|
|
export AWS_SECRET_ACCESS_KEY="PYWvfbsdu6ZFrtTZBBhnWVXmWCp40/cRI/C3yphVOHI="
|
|
export RESTIC_PASSWORD=ei\&SNrq\!7t^Zqkc2#^H6DYvR5^X32HGnUUnd#n
|
|
cd ~/OCI_Build/docker
|
|
restic restore latest:/source/gcloud --target ./
|
|
|
|
- name: Start container using Docker Compose
|
|
ansible.builtin.command:
|
|
cmd: docker compose up -d
|
|
chdir: ~/OCI_Build/docker
|
|
ignore_errors: yes
|
|
|
|
- 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: ~/OCI_Build/docker
|
|
register: container_status
|
|
ignore_errors: yes |