Removed old local binary restic setup, made setup-lxc use other vault files.

This commit is contained in:
tolerryan
2026-07-28 01:02:00 +00:00
parent b460cf8d6b
commit 358aee0239
4 changed files with 60 additions and 268 deletions

View File

@@ -4,13 +4,6 @@
become: true
gather_facts: true
vars_files:
- ./vault.yaml
vars:
restic_repo: "s3:http://misamisa.duckdns.org:9000/resticbackup"
restore_target_path: "/"
# restic_password_value: "Stored in vault"
tasks:
- name: Upgrade-packages.yml - update packages
@@ -25,21 +18,25 @@
- name: Setup-restic.yml - setup restic
ansible.builtin.import_tasks: ./setup-restic.yml
- name: Check if app data directory exists
stat:
path: "/apps/"
register: app_data
- name: Check if /apps/docker exists
ansible.builtin.stat:
path: "/apps/docker"
register: apps_docker_dir
- name: Restic restore app data Dir
ansible.builtin.shell:
cmd: "restic restore latest --tag {{ ansible_hostname }} --target {{ restore_target_path }}"
environment:
RESTIC_REPOSITORY: "{{ restic_repo }}"
RESTIC_PASSWORD: "{{ restic_password_value }}"
AWS_ACCESS_KEY_ID: "{{ aws_access_key_id }}"
AWS_SECRET_ACCESS_KEY: "{{ aws_secret_access_key }}"
args:
creates: "/apps/data"
- name: Check if /apps/data exists
ansible.builtin.stat:
path: "/apps/data"
register: apps_data_dir
- name: Run restore-backups.yaml runbook if either dir is missing
ansible.builtin.command:
cmd: >-
ansible-playbook ../restore-backups.yaml
-i {{ inventory_file }}
--limit {{ inventory_hostname }}
-e confirm_restore=true
delegate_to: localhost
when: not apps_docker_dir.stat.exists or not apps_data_dir.stat.exists
when: not app_data.stat.exists or not app_data.stat.isdir