You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-homelab/ansible/homelab/playbooks/restore-all.yml

151 lines
4.1 KiB
YAML

###
# restore-all restores a manually specified list of volumes.
# This is intended for user when initially setting up a home lab environment
# and want to restore all applications from existing backups
#
# Restores will be skipped if there is no archive in the backup directory.
#
# If a container exists, it will be stopped, restored and started
# If a container does not exist, the volume will be still be created.
###
############################################
# TODO: add a command which lists all the stack, and each stack can list all the containers. From there we can iterate
# through each container in the stack calling restore-volume-tasks.yml and then call create-stack-tasks.yml
############################################
---
- name: Redeploy Portainer and All Volumes
hosts: servers
vars_files:
- ../variables.yml
- ~/.homelab/variables.yml
tasks:
- name: Create next cloud a network
docker_network:
name: nextcloud_net
# The docker volume backup image utilizes these images
- name: Pull ubuntu
docker_image:
name: ubuntu
source: pull
- name: Pull busybox
docker_image:
name: busybox
source: pull
- name: Pull docker-volume-backup
docker_image:
name: "{{docker_volume_backup_image}}"
source: pull
- name: Pull start-portainer-stack
docker_image:
name: ghcr.io/chatton/start-portainer-stack:master
source: pull
- name: Restore Portainer
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "portainer"
- name: Restore Linkding
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "linkding"
- name: Start Linkding Stack
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "linkding"
- name: Restore Nginx Proxy Manager
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "nginx-proxy-manager"
- name: Start Nginx Proxy Manager
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "nginx-proxy-manager"
- name: Restore Vpn Stack
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "vpn-stack"
- name: Start Vpn Stack
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "vpn-stack"
- name: Restore MariaDB
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "mariadb"
- name: Start MariaDB
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "mariadb"
- name: Restore Nextcloud
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "nextcloud"
- name: Start Nextcloud
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "nextcloud"
- name: Restore Photoprism
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "photoprism"
- name: Start Photoprism
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "photoprism"
- name: Restore Plex
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "plex"
- name: Start Plex
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "plex"
- name: Restore Mealie
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "mealie"
- name: Start Mealie
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "mealie"
- name: Restore Overseerr
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "overseerr"
- name: Start Overseerr
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "overseerr"
- name: Restore Uptime Kuma
import_tasks: ../tasks/restore-volume-tasks.yml
vars:
container_name: "uptime-kuma"
- name: Start Uptime Kuma
import_tasks: ../tasks/create-stack-tasks.yml
vars:
stack_name: "uptime-kuma"