You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
547 B

  1. ---
  2. - name: Find old etcd backups
  3. ansible.builtin.find:
  4. file_type: directory
  5. recurse: false
  6. paths: "{{ etcd_backup_prefix }}"
  7. patterns: "etcd-*"
  8. register: _etcd_backups
  9. when: etcd_backup_retention_count >= 0
  10. listen: Restart etcd
  11. - name: Remove old etcd backups
  12. ansible.builtin.file:
  13. state: absent
  14. path: "{{ item }}"
  15. loop: "{{ (_etcd_backups.files | sort(attribute='ctime', reverse=True))[etcd_backup_retention_count:] | map(attribute='path') }}"
  16. when: etcd_backup_retention_count >= 0
  17. listen: Restart etcd