Modularity updates

This commit is contained in:
2025-03-04 14:54:39 -05:00
parent ee6912995c
commit e42fb554a6
7 changed files with 62 additions and 38 deletions

View File

@ -5,9 +5,6 @@
gather_facts: true
strategy: free
vars:
rear_backup_workflow: standalone
tasks:
- name: Import rear_vars role
ansible.builtin.import_role:
@ -32,37 +29,3 @@
- name: Include the backup role
ansible.builtin.include_role:
name: rhc.rear.rear_backup
- name: Confirm ReaR backup log is present
ansible.builtin.stat:
path: "/var/log/rear/rear-{{ ansible_hostname }}.log"
register: rear_backup_log_stat
- name: Backup ReaR log file and create success file
when:
- rear_backup_log_stat['stat']['exists']
block:
- name: Copy ReaR log file to backup location
ansible.builtin.copy:
src: "/var/log/rear/rear-{{ ansible_hostname }}.log"
dest: "/var/log/rear-{{ ansible_hostname }}-{{ '%Y-%m-%d' | strftime(rear_backup_log_stat['stat']['mtime']) }}.log"
mode: "0644"
backup: true
remote_src: true
- name: Remove ReaR log file
ansible.builtin.file:
path: "/var/log/rear/rear-{{ ansible_hostname }}.log"
state: absent
- name: Create success file directory if not present
ansible.builtin.file:
path: "{{ rear_backup_success_file_path }}"
state: directory
mode: "0755"
- name: Create backup success file
ansible.builtin.copy:
dest: "{{ rear_backup_success_file_path }}/{{ rear_backup_workflow }}_rear_success"
content: "success\n"
mode: "0644"