outwire.restic

Ansible 角色:restic

lint quality license

使用 restic 和 runrestic 设置备份。

角色变量

restic_version: 0.12.0
runrestic_version: 0.5.20

要安装的 restic 和 runrestic 的版本。

restic_systemd_timer_oncalendar: daily

创建和修剪时的日期和时间规格。有关可能的值,请参见 systemd 文档

runrestic 配置

必需参数

restic_repository仓库的路径。如果您想备份到多个仓库,可以使用列表。

restic_password:仓库密码。

restic_source_directories:要备份的本地文件夹列表。

可选参数

restic_backup_name: restic backup - 备份名称

restic_execution_parallel: true - 并行创建备份
restic_execution_retry_count: 10 - 重试次数
restic_execution_retry_backoff: 1:00 exponential - 重试策略(静态、线性、指数)

restic_environment_variables: [] - restic 的环境变量,查看 restic 文档 了解所有可用选项

restic_exclude_patterns: [] - 备份排除模式
restic_exclude_files: [] - 排除备份的文件

restic_pre_hooks: [] - 备份前运行的命令
restic_post_hooks: [] - 备份后运行的命令

restic_retention_policy:
  keep_last: 3
  keep_daily: 7
  keep_weekly: 4
  keep_monthly: 6

保留策略,用于定义在每个类别(每日、每周、每月等)中保留多少个备份。

restic_checks: []

一致性检查列表。

restic_metrics_prometheus: false
restic_metrics_prometheus_path: /var/lib/node_exporter/textfile_collector/runrestic.prom

用于 node_exporter 文本文件收集器的 Prometheus 指标。

restic_metrics_prometheus_password_replacement: XXX - 在指标中替换仓库的密码

示例剧本

本地备份

- hosts: servers
  vars:
    restic_repository: /srv/restic-repo
    restic_password: changeme
    restic_source_directories:
      - /var/www
      - /etc
  roles:
     - { role: outwire.restic }

S3 备份

- 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 }

许可证

MIT

关于项目

Set up backups using restic and runrestic

安装
ansible-galaxy install outwire.restic
许可证
mit
下载
7.1k
拥有者