fuzzymistborn.autorestic

Autorestic/Restic 安装器

一个用于安装和配置 resticautorestic 的 ansible 角色。这个角色的灵感来源于 @IronicBadger@ItsNotGoodName,他们对安装程序和配置文件复制进行了改进。

使用 ansible-galaxy install fuzzymistborn.autorestic 进行安装。

特性

  • 安装和配置 resticautorestic 的 GO 二进制文件。
  • 复制/更新 autorestic 配置文件。
  • 如果有更新且版本未固定,则更新二进制文件。

配置

这个角色有多个可以配置的变量。

此外,您可以通过 autorestic_pinned_verrestic_pinned_ver 固定特定版本。默认情况下,该角色会获取并安装最新版本,并在每次运行角色时检查是否已安装二进制文件。如果您希望固定版本,可以禁用此功能。以下是设置版本的示例。

autorestic_download_latest_ver: false
autorestic_pinned_ver: 1.2.0
restic_download_latest_ver: false
restic_pinned_ver: 0.12.1

通过设置固定版本,更新命令将不会运行,仅当安装的版本与固定版本不匹配时才会下载。

其他可以更改的变量:

autorestic_config_user: root
autorestic_config_yaml: CHANGEME  # autorestic 配置文件(yaml 格式)
autorestic_config_path: "{{ autorestic_user_directory }}/.autorestic.yml"
autorestic_config_mode: 0600
autorestic_config_owner: "{{ autorestic_config_user }}"
autorestic_config_group: "{{ autorestic_config_user }}"

autorestic_distro: linux_amd64
restic_distro: linux_amd64

其他变量,例如 restic_gh_urlrestic_install_directory 等,除非您想自定义安装,否则我不建议更改。

请查看 autoresticrestic 的发布页面,以找到适合您安装的正确版本。

Autorestic 配置文件示例

默认情况下,Autorestic 配置文件会复制到 root 用户的主目录。您可以使用 autorestic_config_user 变量将其更改为其他用户的主目录。

以下是一个显示所有可用选项的示例。

autorestic_config_yaml:
  locations:
    docker:
      from: '/opt/docker'
      to:
        - local
        - b2_docker
  backends:
    local:
      type: local
      path: /backup
      key: 123
    b2_docker:
      type: s3
      path: 'b2_backend_url'
      key: b2_password
      env:
        AWS_ACCESS_KEY_ID: 1234
        AWS_SECRET_ACCESS_KEY: 1234abc

有关更多文档,请参阅 官方文档

Github API

这个角色利用 GitHub API 来确定最新的可用发布版本。默认情况下,角色使用未经身份验证的请求,GitHub 会将其限制为每小时 60 次请求。这些请求与来源 IP 地址相关联。在大多数使用场景中,这不是问题。然而,您可能会发现自己受到请求限制。如果您进行身份验证,可以每小时进行 5000 次请求。

要进行身份验证,您必须获取 个人访问令牌。该令牌无需选择任何作用域。然后添加以下变量:

github_api_user: fuzzymistborn
github_api_pass: YOUR_TOKEN
github_api_auth: yes

就这样!

待办事项

  • 添加 cronjob 变量 (?) 用于基本任务(备份,忘记等)。
    • 我认为我不会实现。太个性化了,而且有太多的变种。我会继续寻找解决方法。
  • 寻找固定 restic 的方法,即使在更新 autorestic 时。

如果您欣赏我的工作,请考虑请我喝一杯啤酒(或咖啡,或其他饮品)

ko-fi

关于项目

Installs restic/autorestic and creates backup configuration file

安装
ansible-galaxy install fuzzymistborn.autorestic
许可证
gpl-3.0
下载
44.3k
拥有者