New roles for better modularity

This commit is contained in:
2025-03-03 18:03:55 -05:00
parent fcc4e023da
commit 70dc11455a
6 changed files with 57 additions and 49 deletions

View File

@ -0,0 +1,21 @@
---
- 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