vrischmann.restic

Restic

使用 systemd 服务和定时器部署 restic 备份。

此角色有两种模式:

  • user 模式为用户添加全局服务和定时器(适用于普通用户)。
  • server 模式为系统添加全局服务和定时器。

要求

您需要安装 restic,并且已经初始化了您的存储库。

角色变量

名称 必需 描述
restic_binary restic 二进制文件的完整路径。
restic_backup_mode 备份模式(可选 "user" 或 "server")。
restic_user_home 用户的主目录(在 "user" 模式下运行时)。
restic_user_name 用户的姓名(在 "user" 模式下运行时)。
restic_user_group 用户的组(在 "user" 模式下运行时)。
restic_backups restic 的备份定义列表。
restic_conf_directory 配置目录(在 "server" 模式下运行时)。

备份定义

restic_backups 列表包含 N 项定义备份。

每个备份定义必须包含以下信息:

  • 存储库名称(用于 systemd 服务:只使用字母数字字符)
  • restic 使用存储库的环境变量
  • systemd 定时器的日历规格。
  • 要备份的目录

还可以包含要排除的目录列表。

例如,这里定义了两个存储库:

restic_backups:
  - name: remote-scaleway
    env:
      AWS_ACCESS_KEY_ID: "{{ restic_scaleway_aws_access_key_id }}"
      AWS_SECRET_ACCESS_KEY: "{{ restic_scaleway_aws_secret_access_key }}"
      RESTIC_REPOSITORY: "s3:s3.fr-par.scw.cloud/foobar/home"
      RESTIC_PASSWORD: "{{ restic_remote_password }}"
    calendar_spec: "*-*-* *:00/15:00"
    backup_directories:
      - /home/vincent
    excludes:
      - /home/vincent/tmp

  - name: remote-linode
    env:
      AWS_ACCESS_KEY_ID: "{{ restic_linode_aws_access_key_id }}"
      AWS_SECRET_ACCESS_KEY: "{{ restic_linode_aws_secret_access_key }}"
      RESTIC_REPOSITORY: "s3:eu-central-1.linodeobjects.com/foobar/barbaz"
      RESTIC_PASSWORD: "{{ restic_remote_password }}"
    calendar_spec: "*-*-* *:00/15:00"
    backup_directories:
      - /data/media
    excludes:
      - /data/media/Movies

许可证

MIT

关于项目

Deploy restic backups using systemd services and timers

安装
ansible-galaxy install vrischmann.restic
许可证
mit
下载
134
拥有者
Still learning