diff --git a/roles/backup/defaults/main.yml b/roles/backup/defaults/main.yml index e35a212..53d3e46 100644 --- a/roles/backup/defaults/main.yml +++ b/roles/backup/defaults/main.yml @@ -10,8 +10,7 @@ backup_dateformat: "%Y-%m-%d-%H%M" # List of files/directories to back up # Note that tar is NOT instructed to recurse through symlinks # If you want it to do that, end the path with a slash! -backup_s3backup_list: - - /root +backup_s3backup_list: [] backup_s3backup_list_extra: [] # Arguments to pass to tar # Note that passing f here is probably a bad idea diff --git a/roles/backup/templates/s3backup.sh b/roles/backup/templates/s3backup.sh index 44b808f..dac8b7c 100644 --- a/roles/backup/templates/s3backup.sh +++ b/roles/backup/templates/s3backup.sh @@ -42,6 +42,10 @@ export AWS_SECRET_ACCESS_KEY="{{ backup_s3backup_aws_secret_access_key }}" # Tar up all items in the backup list, recursively, and pipe them straight # up to S3 +if [ -z "${DIRS[@]}" ]; then + echo "No directories configured to back up!" + exit 0 +fi echo "Commencing backup on the following items:" for dir in "${DIRS[@]}"; do echo "- $dir"