Skip to content
Snippets Groups Projects
Unverified Commit 4b858b64 authored by axelgobletbdr's avatar axelgobletbdr Committed by GitHub
Browse files

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
parent e03e3c45
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@ etcd_events_cluster_enabled: false
etcd_backup_prefix: "/var/backups"
etcd_data_dir: "/var/lib/etcd"
# Number of etcd backups to retain. Set to a value < 0 to retain all backups
etcd_backup_retention_count: -1
etcd_config_dir: /etc/ssl/etcd
etcd_cert_dir: "{{ etcd_config_dir }}/ssl"
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment