diff --git a/playbooks/rear_backup.yml b/playbooks/rear_backup.yml index 9a98c29..35cbede 100644 --- a/playbooks/rear_backup.yml +++ b/playbooks/rear_backup.yml @@ -5,6 +5,10 @@ gather_facts: true strategy: free + vars: + standalone_backup_success_path: "/var/log/IPE/IPU/el7to8" + standalone_backup_success_file: "{{ standalone_backup_success_path }}/standalone_rear_success" + tasks: - name: Include the backup role @@ -19,7 +23,7 @@ path: "/var/log/rear/rear-{{ ansible_hostname }}.log" register: rear_backup_log_stat - - name: Backup ReaR log file + - name: Backup ReaR log file and create success file when: - rear_backup_log_stat['stat']['exists'] block: @@ -35,3 +39,15 @@ 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: "{{ standalone_backup_success_path }}" + state: directory + mode: "0755" + + - name: Create backup success file + ansible.builtin.copy: + dest: "{{ standalone_backup_success_file }}" + content: "success\n" + mode: "0644"