Slight tweaks

This commit is contained in:
Chris Hammer 2025-02-05 14:53:45 -05:00
parent 46ea789d8c
commit 42f4a94685
5 changed files with 67 additions and 7 deletions

View File

@ -10,9 +10,9 @@
- name: "Debug survey: rear_force_backup"
ansible.builtin.debug:
var: rear_force_backup
when:
- rear_force_backup is defined
- name: Include the backup role
ansible.builtin.include_role:
name: ../roles/rear_backup
when:
- rear_force_backup | default(false) | bool

View File

@ -0,0 +1,51 @@
---
- name: Perform a ReaR backup
hosts: all
become: true
gather_facts: true
strategy: free
vars:
rear_backup_success_path: "/var/log/IPE/IPU"
rear_backup_success_file: "{{ rear_backup_success_path }}/bigboot_success"
tasks:
- name: Check for backup log presence
ansible.builtin.stat:
path: "/var/log/rear/rear-{{ ansible_hostname }}.log"
register: rear_backup_log_presence
- name: ReaR Backup Validation
when:
- rear_backup_log_presence['stat']['exists'] | bool
block:
- name: Validate ReaR backup completion
ansible.builtin.command:
cmd: "grep 'Finished running mkbackup workflow' /var/log/rear/rear-{{ ansible_hostname }}.log"
changed_when: false
register: validate_backup_log
- name: Debug validate_backup_log
ansible.builtin.debug:
var: validate_backup_log
verbosity: 1
- name: Create log file directory if not present
ansible.builtin.file:
path: "{{ rear_backup_success_path }}"
state: directory
mode: "0755"
- name: Create Bigboot backup success file
ansible.builtin.copy:
dest: "{{ rear_backup_success_file }}"
content: "success"
mode: "0644"
rescue:
- name: No backup log found
ansible.builtin.debug:
msg: "ReaR backup log could not be found to verify backup status. Please run the backup and try again."
- name: OS Failure
ansible.builtin.debug:
msg: "OS failure: Expecting version {{ ansible_distribution_major_version }}, got {{ ansible_distribution_major_version | int + 1 }}"

View File

@ -1,6 +1,8 @@
---
rear_nfs_srv: "10.10.42.180/backups"
rear_backup_success_file: /var/log/IPE/IPU/bigboot_success
# rear_backup_initrd_modules_exclude:
# - scsi_debug
# - falcon_lsm_serviceable

View File

@ -16,16 +16,19 @@
mode: "0600"
- name: ReaR Backup
when:
- rear_force_backup | default(false) | bool
block:
- name: Execute ReaR backup
ansible.builtin.command: rear -d -v mkbackup
changed_when: true
register: rear_mkbackup
- name: ReaR backup success
ansible.builtin.debug:
msg: "ReaR backup has completed successfully."
rescue:
- name: ReaR backup failed
ansible.builtin.debug:
msg: "ReaR backup has failed. Please review the logs for any errors, and try again."
- name: ReaR backup success
ansible.builtin.debug:
msg: "ReaR backup has completed successfully."

View File

@ -17,10 +17,14 @@
- name: Debug roles_path
ansible.builtin.debug:
var: roles_path
var: role_path
# - name: Include rear_restore role for fun
# ansible.builtin.import_role:
# name: ../roles/rear_restore
- name: Include rear_restore role for fun
ansible.builtin.import_role:
name: ../roles/rear_restore
name: "{{ role_path }}/../rear_restore"
...