Add log archive and task shuffle
This commit is contained in:
parent
d583c511bb
commit
09fad57ac6
22
bigboot_backup_rear_log.yml
Normal file
22
bigboot_backup_rear_log.yml
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: Check previous log file
|
||||
ansible.builtin.stat:
|
||||
path: "/var/log/rear/rear-{{ ansible_hostname }}.log"
|
||||
register: old_rear_log
|
||||
|
||||
- name: Backup ReaR log file
|
||||
when:
|
||||
- old_rear_log['stat']['exists']
|
||||
block:
|
||||
- name: Copy old 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(old_rear_log['stat']['mtime']) }}.log"
|
||||
mode: "0644"
|
||||
backup: true
|
||||
remote_src: true
|
||||
|
||||
- name: Remove old ReaR log file
|
||||
ansible.builtin.file:
|
||||
path: "/var/log/rear/rear-{{ ansible_hostname }}.log"
|
||||
state: absent
|
@ -35,6 +35,19 @@
|
||||
vars:
|
||||
rear_nfs_export_share: "{{ bigboot_nfs_backup_share }}"
|
||||
|
||||
- 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(old_rear_log['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: "{{ bigboot_backup_success_path }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user