mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-06-01 04:57:53 -02:30
This make native ansible features (dry-run, changed state) easier to have, and should have a minimal performance impact, since it only runs on the etcd members.
23 lines
620 B
YAML
23 lines
620 B
YAML
---
|
|
- name: Cleanup etcd backups
|
|
command: /bin/true
|
|
notify:
|
|
- Find old etcd backups
|
|
- Remove old etcd backups
|
|
|
|
- name: Find old etcd backups
|
|
ansible.builtin.find:
|
|
file_type: directory
|
|
recurse: false
|
|
paths: "{{ etcd_backup_prefix }}"
|
|
patterns: "etcd-*"
|
|
register: _etcd_backups
|
|
when: etcd_backup_retention_count >= 0
|
|
|
|
- name: Remove old etcd backups
|
|
ansible.builtin.file:
|
|
state: absent
|
|
path: "{{ item }}"
|
|
loop: "{{ (_etcd_backups.files | sort(attribute='ctime', reverse=True))[etcd_backup_retention_count:] | map(attribute='path') }}"
|
|
when: etcd_backup_retention_count >= 0
|