Created
November 13, 2019 15:09
-
-
Save vterdunov/f33bac731bef7d1e4da1f5b1f0578266 to your computer and use it in GitHub Desktop.
remove old backuped files but keep 2 newest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Find backuped files | |
find: | |
paths: /path/to/files/ | |
patterns: file.yml.* | |
register: backuped_files | |
- debug: | |
msg: "{{ item.path }}" | |
loop: "{{ (backuped_files.files | sort(attribute='ctime',reverse=true))[2:] | list }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment