Update archive to include workflow name; restore rough draft

This commit is contained in:
Chris Hammer 2025-03-05 10:46:54 -05:00
parent 2f2801b79f
commit be4aa9282e
2 changed files with 31 additions and 10 deletions

View File

@ -17,14 +17,35 @@
# Won't we need to regenerate the local.cfg? # Won't we need to regenerate the local.cfg?
# Could we save the archive to etc-rear-{{ workflow }}.tar.gz and restore from that? # Could we save the archive to etc-rear-{{ workflow }}.tar.gz and restore from that?
tasks: tasks:
- name: Import rear_vars role - name: Check if configuration backup exists
ansible.builtin.import_role: ansible.builtin.stat:
name: rhc.rear.rear_vars path: "/root/etc-rear-backup-{{ rear_backup_workflow }}.tar.gz"
register: rear_config_backup_stat
- name: Configure ReaR local.conf file - name: Create tmpdir and extract archive
ansible.builtin.include_role: when:
name: rhc.rear.rear_local_cfg - rear_config_backup_stat['stat']['exists'] | bool
block:
- name: Create tmpdir
ansible.builtin.file:
path: /tmp/unarchive
state: directory
mode: "0755"
- name: Perform ReaR restore - name: Extract archive contents
ansible.builtin.include_role: ansible.builtin.unarchive:
name: rhc.rear.rear_restore remote_src: true
src: "/root/etc-rear-backup-{{ rear_backup_workflow }}.tar.gz"
dest: /tmp/unarchive
# - name: Import rear_vars role
# ansible.builtin.import_role:
# name: rhc.rear.rear_vars
# - name: Configure ReaR local.conf file
# ansible.builtin.include_role:
# name: rhc.rear.rear_local_cfg
# - name: Perform ReaR restore
# ansible.builtin.include_role:
# name: rhc.rear.rear_restore

View File

@ -57,7 +57,7 @@
- name: Create backup of ReaR configuration files - name: Create backup of ReaR configuration files
community.general.archive: community.general.archive:
path: /etc/rear path: /etc/rear
dest: /root/etc-rear-backup.tar.gz dest: /root/etc-rear-backup-{{ rear_backup_workflow }}.tar.gz
format: gz format: gz
force_archive: true force_archive: true
mode: "0600" mode: "0600"