Variable cleanup, configuration backup, log archive post-backup
This commit is contained in:
@ -13,3 +13,25 @@
|
||||
when:
|
||||
- ansible_distribution_major_version >= '7'
|
||||
- not rear_backup_skip | default(false) | bool
|
||||
|
||||
- name: Verify 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
|
||||
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
|
||||
|
Reference in New Issue
Block a user