Fixes 6621 etcd backup directory is consuming much rootfs disk space (#6836)

* added an ansible var to manage retention of etcd backups

* refactord ls/grep into find in etcd backup removal command
This commit is contained in:
axelgobletbdr
2020-10-23 16:09:57 +02:00
committed by GitHub
parent e03e3c4582
commit 4b858b6466
2 changed files with 9 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
- Stat etcd v2 data directory
- Backup etcd v2 data
- Backup etcd v3 data
- Remove old etcd backups
when: etcd_cluster_is_healthy.rc == 0
- name: Refresh Time Fact
@@ -57,3 +58,9 @@
register: etcd_backup_v3_command
until: etcd_backup_v3_command.rc == 0
delay: "{{ retry_stagger | random + 3 }}"
- name: Remove old etcd backups
shell:
chdir: "{{ etcd_backup_prefix }}"
cmd: "find . -name 'etcd-*' | head -n -{{ etcd_backup_retention_count }} | xargs rm -rf"
when: etcd_backup_retention_count >= 0