Update checks and logic
All checks were successful
Ansible Lint Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Successful in 46s
All checks were successful
Ansible Lint Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Successful in 46s
This commit is contained in:
@ -1,52 +1,4 @@
|
|||||||
---
|
---
|
||||||
# Collections must specify a minimum required ansible version to upload
|
# Collections must specify a minimum required ansible version to upload
|
||||||
# to galaxy
|
# to galaxy
|
||||||
requires_ansible: '>=2.14.0'
|
requires_ansible: '>=2.15.0'
|
||||||
|
|
||||||
# Content that Ansible needs to load from another location or that has
|
|
||||||
# been deprecated/removed
|
|
||||||
# plugin_routing:
|
|
||||||
# action:
|
|
||||||
# redirected_plugin_name:
|
|
||||||
# redirect: ns.col.new_location
|
|
||||||
# deprecated_plugin_name:
|
|
||||||
# deprecation:
|
|
||||||
# removal_version: "4.0.0"
|
|
||||||
# warning_text: |
|
|
||||||
# See the porting guide on how to update your playbook to
|
|
||||||
# use ns.col.another_plugin instead.
|
|
||||||
# removed_plugin_name:
|
|
||||||
# tombstone:
|
|
||||||
# removal_version: "2.0.0"
|
|
||||||
# warning_text: |
|
|
||||||
# See the porting guide on how to update your playbook to
|
|
||||||
# use ns.col.another_plugin instead.
|
|
||||||
# become:
|
|
||||||
# cache:
|
|
||||||
# callback:
|
|
||||||
# cliconf:
|
|
||||||
# connection:
|
|
||||||
# doc_fragments:
|
|
||||||
# filter:
|
|
||||||
# httpapi:
|
|
||||||
# inventory:
|
|
||||||
# lookup:
|
|
||||||
# module_utils:
|
|
||||||
# modules:
|
|
||||||
# netconf:
|
|
||||||
# shell:
|
|
||||||
# strategy:
|
|
||||||
# terminal:
|
|
||||||
# test:
|
|
||||||
# vars:
|
|
||||||
|
|
||||||
# Python import statements that Ansible needs to load from another location
|
|
||||||
# import_redirection:
|
|
||||||
# ansible_collections.ns.col.plugins.module_utils.old_location:
|
|
||||||
# redirect: ansible_collections.ns.col.plugins.module_utils.new_location
|
|
||||||
|
|
||||||
# Groups of actions/modules that take a common set of options
|
|
||||||
# action_groups:
|
|
||||||
# group_name:
|
|
||||||
# - module1
|
|
||||||
# - module2
|
|
||||||
|
@ -1,29 +1,33 @@
|
|||||||
---
|
---
|
||||||
- name: Check ReaR Output details
|
- name: Check ReaR Output details
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "/var/lib/rear"
|
path: /boot/rear-initrd.cgz
|
||||||
register: file_details
|
register: file_details
|
||||||
|
|
||||||
- name: Set current Date and ReaR file date
|
- name: Check dates and cleanup ReaR backup as needed
|
||||||
ansible.builtin.set_fact:
|
|
||||||
date_now: "{{ ansible_date_time['date'] }}"
|
|
||||||
file_date: "{{ '%Y-%m-%d' | strftime(file_details['stat']['mtime']) }}"
|
|
||||||
when:
|
when:
|
||||||
- file_details['stat']['exists'] | bool
|
- file_details['stat']['exists'] | bool
|
||||||
|
block:
|
||||||
|
- 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
|
- name: Compare Dates to delete based on our 2 days retention policy
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
file_status: "{{ ((date_now | to_datetime('%Y-%m-%d')) - (file_date | to_datetime('%Y=%m-%d'))).days }}"
|
file_status: "{{ ((date_now | to_datetime('%Y-%m-%d')) - (file_date | to_datetime('%Y-%m-%d'))).days }}"
|
||||||
when:
|
when:
|
||||||
- file_details['stat']['exists'] | bool
|
- file_details['stat']['exists'] | bool
|
||||||
|
|
||||||
# - name: Include Cleanup if the ReaR file is created 6 days back
|
- name: Include Cleanup if the ReaR file is created 6 days back
|
||||||
# ansible.builtin.include_tasks: cleanup.yml
|
ansible.builtin.include_tasks: cleanup.yml
|
||||||
# when:
|
when:
|
||||||
# - not (file_status|int <= 6)
|
- not (file_status|int <= 6)
|
||||||
|
|
||||||
- name: Print Msg if ReaR file doesnt exist
|
- name: Print Msg if ReaR file doesnt exist
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "The ReaR files don't exist on this server."
|
msg: "The ReaR files don't exist on this server."
|
||||||
when:
|
when:
|
||||||
- not file_details['stat']['exists'] | bool
|
- not file_details['stat']['exists'] | bool
|
||||||
|
Reference in New Issue
Block a user