outwire.restic
Ansible Role: restic
This role sets up backups using restic and runrestic.
Role Variables
restic_version: 0.12.0
runrestic_version: 0.5.20
These are the versions of restic and runrestic that will be installed.
restic_systemd_timer_oncalendar: daily
This specifies the schedule for when backups will be created and old ones removed. Check the systemd documentation for scheduling options.
runrestic Configuration
Required Arguments
restic_repository
: The path to the repository. You can list multiple paths if you want to back up to several repositories.
restic_password
: The password for the repository.
restic_source_directories
: A list of local folders that you want to back up.
Optional Arguments
restic_backup_name: restic backup
- Name for the backup
restic_execution_parallel: true
- Enable parallel backup creationrestic_execution_retry_count: 10
- Number of retries allowedrestic_execution_retry_backoff: 1:00 exponential
- Strategies for retries (static, linear, exponential)
restic_environment_variables: []
- Environment variables for restic. See restic documentation for options.
restic_exclude_patterns: []
- Patterns to ignore during the backuprestic_exclude_files: []
- Specific files to ignore during the backup
restic_pre_hooks: []
- Commands to run before the backuprestic_post_hooks: []
- Commands to run after the backup
restic_retention_policy:
keep_last: 3
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
This sets how many backups to keep for each category (daily, weekly, monthly, etc.).
restic_checks: []
A list of checks for consistency.
restic_metrics_prometheus: false
restic_metrics_prometheus_path: /var/lib/node_exporter/textfile_collector/runrestic.prom
Metrics for Prometheus and node_exporter textfile collector.
restic_metrics_prometheus_password_replacement: XXX
- Replace passwords in metrics with this text.
Example Playbook
Local Backup
- hosts: servers
vars:
restic_repository: /srv/restic-repo
restic_password: changeme
restic_source_directories:
- /var/www
- /etc
roles:
- { role: outwire.restic }
S3 Backup
- hosts: servers
vars:
restic_repository: s3:s3.example.com/bucket123/backup
restic_password: changeme
restic_environment_variables:
AWS_ACCESS_KEY_ID: changeme_access_key
AWS_SECRET_ACCESS_KEY: changeme_secret_key
restic_source_directories:
- /var/www
- /etc
roles:
- { role: outwire.restic }
License
MIT