Updates for bigboot_rear_backup.yml; Add bigboot_rear_clean.yml

This commit is contained in:
Chris Hammer 2025-02-27 19:53:26 -05:00
parent 2bce76e413
commit 4c75f10ec3
2 changed files with 37 additions and 6 deletions

View File

@ -5,17 +5,42 @@
gather_facts: true
strategy: free
vars:
bigboot_backup_success_file: /var/log/IPE/IPU/bigboot_rear_success
bigboot_nfs_backup_share: /backups/bigboot
bigboot_nfs_backup_share_fsid: 20
tasks:
- name: Fetch the template name from NFS exports
ansible.builtin.set_fact:
job_template_name: "{{ nfs_exports_template_name }}"
- name: Perform ReaR backup # noqa var-naming
ansible.builtin.include_role:
name: rhc.rear.rear_backup
vars:
rear_nfs_export_share: /backups/bigboot
rear_nfs_export_fsid: 10
- name: Check for previous backup for Bigboot
ansible.builtin.stat:
path: "{{ bigboot_backup_success_file }}"
register: bigboot_backup_success
- name: Perform ReaR Backup and write success log
when:
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool
- not rear_backup_success['stat']['exists'] | bool
block:
- name: Perform ReaR backup # noqa var-naming
ansible.builtin.include_role:
name: rhc.rear.rear_backup
vars:
rear_nfs_export_share: "{{ bigboot_nfs_backup_share }}"
rear_nfs_export_fsid: "{{ bigboot_nfs_backup_share_fsid }}"
- name: Create success 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\n"
mode: "0644"

6
bigboot_rear_clean.yml Normal file
View File

@ -0,0 +1,6 @@
---
- name: Cleanup ReaR artifacts on successful Bigboot
ansible.builtin.import_playbook: rhc.rear.rear_remove
when:
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool