Maloja Import Backup
This role restores Maloja music scrobbling data from backup files created by `maloja_backup`.
Overview
This role restores Maloja music scrobbling data from backup files created by maloja_backup. It automatically identifies the latest backup, copies it to Maloja’s import directory, triggers import by restarting the container, and monitors the import process through container logs. The role is designed specifically for Docker-based Maloja deployments.
What This Role Does
- Ensures import directory exists (
docker_data_path/maloja/import/) - Finds all backup files on NAS matching
maloja_export_*.json - Sorts by modification time and selects most recent
- Fails gracefully if no backups found
- Displays backup information (filename and size in MB)
- Copies backup to import directory with correct ownership
- Restarts Maloja container to trigger import process
- Waits 5 seconds for container to initialize
- Monitors logs for “Parsing” message (import started)
- Displays import start message
- Monitors logs for “Successfully imported” message (import completed)
- Displays import completion message
- Checks for skipped scrobbles and displays count
- Removes import file after successful import
- Restarts Maloja again to clean up
- Displays success message
Role Variables
| Variable | Description |
|---|---|
docker_compose_directory | Docker Compose project directory (from host_vars) |
docker_data_path | Docker data volumes directory (from host_vars) |
docker_user | Docker volume owner user (from host_vars) |
docker_maloja_container_name | Maloja container name (from host_vars) |
maloja_import_backup_dir | Import directory inside Docker volume |
maloja_import_backup_syno_mount_point | NAS path with backup files |
Notes
- Automatically selects the most recent
maloja_export_*.jsonfile from the NAS - Copies the file to the Maloja import directory, restarts the container, then monitors logs
- Import file is deleted after successful import; container is restarted again for a clean state
- Duplicate scrobbles are automatically skipped by Maloja