From 1dbf436a50bc8feabdb3e20989816ebd0323b121 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Sat, 11 Nov 2023 09:24:48 -0600 Subject: [PATCH] Add a backup disk usage analyzer script --- roles/backup/tasks/main.yml | 2 ++ roles/backup/templates/s3backup-analyze.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 roles/backup/templates/s3backup-analyze.sh diff --git a/roles/backup/tasks/main.yml b/roles/backup/tasks/main.yml index 6fd4b8e..54d1d14 100644 --- a/roles/backup/tasks/main.yml +++ b/roles/backup/tasks/main.yml @@ -3,6 +3,8 @@ --- - name: template out backup script ansible.builtin.template: src={{ backup_script }}.sh dest=/opt/backup.sh mode=0700 owner=root group=root +- name: template out analyze script + ansible.builtin.template: src={{ backup_script }}-analyze.sh dest=/opt/analyze.sh mode=0700 owner=root group=root - name: template out restore script ansible.builtin.template: src={{ restore_script }}.sh dest=/opt/restore.sh mode=0700 owner=root group=root - name: configure systemd service diff --git a/roles/backup/templates/s3backup-analyze.sh b/roles/backup/templates/s3backup-analyze.sh new file mode 100644 index 0000000..0c3c0de --- /dev/null +++ b/roles/backup/templates/s3backup-analyze.sh @@ -0,0 +1,17 @@ +#! /bin/bash +# +# s3backup-analyze.sh +# A companion script to s3backup to analyze disk usage for backups + +# NOTICE: DO NOT MODIFY THIS FILE +# Any changes made will be clobbered by Ansible +# Please make any configuration changes in the main repo + +exec ncdu \ +{% for item in backup_s3backup_list + backup_s3backup_list_extra %} + "{{ item }}" \ +{% endfor %} +{% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %} + --exclude "{{ item }}" \ +{% endfor %} +-r