2022-08-05 23:09:59 +08:00
|
|
|
---
|
2023-10-31 03:05:28 +08:00
|
|
|
- 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
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Restart etcd
|
2023-10-31 03:05:28 +08:00
|
|
|
|
2022-08-05 23:09:59 +08:00
|
|
|
- name: Remove old etcd backups
|
2023-10-31 03:05:28 +08:00
|
|
|
ansible.builtin.file:
|
|
|
|
state: absent
|
|
|
|
path: "{{ item }}"
|
|
|
|
loop: "{{ (_etcd_backups.files | sort(attribute='ctime', reverse=True))[etcd_backup_retention_count:] | map(attribute='path') }}"
|
2022-08-05 23:09:59 +08:00
|
|
|
when: etcd_backup_retention_count >= 0
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Restart etcd
|