Make fsid dynamic; Add backup validation - verify rear_force_backup

This commit is contained in:
Chris Hammer 2025-02-22 19:25:17 -05:00
parent 195981002e
commit c8f40471cd
3 changed files with 27 additions and 1 deletions

View File

@ -39,7 +39,11 @@
path: /etc/exports
state: present
line: "{{ rear_nfs_export_share }} {{ _options }}"
create: true
mode: "0644"
owner: root
group: root
loop: "{{ client_ips | list | flatten }}"
vars:
_options: "{{ item }}(fsid=0,rw,sync,no_subtree_check,crossmnt)"
_options: "{{ item }}(fsid={{ rear_nfs_export_fsid }},rw,sync,no_subtree_check,crossmnt)"
notify: Export share

View File

@ -1,2 +1,3 @@
---
rear_nfs_export_share: "/backups/standalone"
rear_nfs_export_fsid: 0

View File

@ -1,4 +1,25 @@
---
- name: Check for backup log presence
ansible.builtin.stat:
path: "/var/log/rear/rear-{{ ansible_hostname }}.log"
register: rear_backup_log_presence
- name: End host if ReaR backup already exists
when:
- rear_backup_log_presence['stat']['exists'] | bool
- not rear_force_backup | default(false) | bool
block:
- name: Validate ReaR backup completion
ansible.builtin.command:
cmd: "grep 'Finished running mkbackup workflow' /var/log/rear/rear-{{ ansible_hostname }}.log"
register: validate_backup_log
failed_when: validate_backup_log['rc'] not in [0,1]
- name: End play if ReaR already exists
ansible.builtin.meta: end_host
when:
- validate_backup_log['rc'] == 0
- name: Ensure nfs-utils and rear packages are present
ansible.builtin.package:
name: