Some checks failed
Ansible Lint Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Failing after 11s
30 lines
960 B
YAML
30 lines
960 B
YAML
---
|
|
- name: Check ReaR Output details
|
|
ansible.builtin.stat:
|
|
path: "/var/lib/rear"
|
|
register: file_details
|
|
|
|
- name: Set current Date and ReaR file date
|
|
ansible.builtin.set_fact:
|
|
date_now: "{{ ansible_date_time['date'] }}"
|
|
file_date: "{{ '%Y-%m-%d' | strftime(file_details['stat']['mtime']) }}"
|
|
when:
|
|
- file_details['stat']['exists'] | bool
|
|
|
|
- name: Compare Dates to delete based on our 2 days retention policy
|
|
ansible.builtin.set_fact:
|
|
file_status: "{{ ((date_now | to_datetime('%Y-%m-%d')) - (file_date | to_datetime('%Y=%m-%d'))).days }}"
|
|
when:
|
|
- file_details['stat']['exists'] | bool
|
|
|
|
# - name: Include Cleanup if the ReaR file is created 6 days back
|
|
# ansible.builtin.include_tasks: cleanup.yml
|
|
# when:
|
|
# - not (file_status|int <= 6)
|
|
|
|
- name: Print Msg if ReaR file doesnt exist
|
|
ansible.builtin.debug:
|
|
msg: "The ReaR files don't exist on this server."
|
|
when:
|
|
- not file_details['stat']['exists'] | bool
|