Slight tweaks
This commit is contained in:
parent
46ea789d8c
commit
42f4a94685
@ -10,9 +10,9 @@
|
|||||||
- name: "Debug survey: rear_force_backup"
|
- name: "Debug survey: rear_force_backup"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: rear_force_backup
|
var: rear_force_backup
|
||||||
|
when:
|
||||||
|
- rear_force_backup is defined
|
||||||
|
|
||||||
- name: Include the backup role
|
- name: Include the backup role
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: ../roles/rear_backup
|
name: ../roles/rear_backup
|
||||||
when:
|
|
||||||
- rear_force_backup | default(false) | bool
|
|
||||||
|
51
playbooks/rear_backup_validate.yml
Normal file
51
playbooks/rear_backup_validate.yml
Normal 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 }}"
|
@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
rear_nfs_srv: "10.10.42.180/backups"
|
rear_nfs_srv: "10.10.42.180/backups"
|
||||||
|
|
||||||
|
rear_backup_success_file: /var/log/IPE/IPU/bigboot_success
|
||||||
|
|
||||||
# rear_backup_initrd_modules_exclude:
|
# rear_backup_initrd_modules_exclude:
|
||||||
# - scsi_debug
|
# - scsi_debug
|
||||||
# - falcon_lsm_serviceable
|
# - falcon_lsm_serviceable
|
||||||
|
@ -16,16 +16,19 @@
|
|||||||
mode: "0600"
|
mode: "0600"
|
||||||
|
|
||||||
- name: ReaR Backup
|
- name: ReaR Backup
|
||||||
|
when:
|
||||||
|
- rear_force_backup | default(false) | bool
|
||||||
block:
|
block:
|
||||||
- name: Execute ReaR backup
|
- name: Execute ReaR backup
|
||||||
ansible.builtin.command: rear -d -v mkbackup
|
ansible.builtin.command: rear -d -v mkbackup
|
||||||
changed_when: true
|
changed_when: true
|
||||||
register: rear_mkbackup
|
register: rear_mkbackup
|
||||||
|
|
||||||
|
- name: ReaR backup success
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "ReaR backup has completed successfully."
|
||||||
rescue:
|
rescue:
|
||||||
- name: ReaR backup failed
|
- name: ReaR backup failed
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "ReaR backup has failed. Please review the logs for any errors, and try again."
|
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."
|
|
||||||
|
@ -17,10 +17,14 @@
|
|||||||
|
|
||||||
- name: Debug roles_path
|
- name: Debug roles_path
|
||||||
ansible.builtin.debug:
|
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
|
- name: Include rear_restore role for fun
|
||||||
ansible.builtin.import_role:
|
ansible.builtin.import_role:
|
||||||
name: ../roles/rear_restore
|
name: "{{ role_path }}/../rear_restore"
|
||||||
|
|
||||||
...
|
...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user