[Unit]
Description=Backup: {{ item.name }}
After=network.target

[Service]
Type=oneshot
User={{ item.user | default('root') }}
Group={{ item.group | default('backups') }}

Environment="RESTIC_REPOSITORY={{ backup_restic_repository }}"
Environment="RESTIC_PASSWORD_FILE={{ backup_restic_password_file }}"
Environment="OTEL_EXPORTER_OTLP_ENDPOINT={{ backup_otel_endpoint }}"
Environment="OTEL_SERVICE_NAME={{ backup_otel_service_name }}"

ExecStart=/usr/bin/otel-cli exec \
    --name "{{ item.name }}" \
    --attrs 'backup.type={{ item.type }}' -- /usr/bin/bash {{ backup_scripts_dir }}/{{ item.name }}.backup.sh

[Install]
WantedBy=multi-user.target
