hadret.restic
Ansible角色:Restic
一个在Linux和FreeBSD上安装restic的Ansible角色。
要求
无。
角色变量
可用变量如下所示,以及默认值(见defaults/main.yml):
restic_version: '0.15.1'
restic_install_path: '/usr/local/bin'
restic_password_file_path: '/root'
restic_discard_cron_stdout: false
restic_user: root
restic_group: "{{ restic_user }}"
restic_version
指定要安装的restic二进制文件的版本。该版本与GitHub存储库中的发布版本相匹配。restic_install_path
提供restic二进制文件可用的路径(/usr/local/bin
默认作为$PATH
的一部分导出)。这个路径也是执行实际备份的包装脚本所使用的路径,脚本名称构造为$restic_install_path/restic-$job_name
(稍后会详细说明)。restic_password_file_path
提供用于存储restic仓库密码文件的文件夹路径。每个文件以$restic_password_file_path/.restic-@job_name
构造。默认情况下,这些文件是隐藏的(因此文件名前有.
),并且仅限于restic_user
和restic_group
进行只读访问。这些默认值为root
,但可以覆盖,可以使用任何有效的/已存在的用户。在这种情况下,将确保该用户的适当权限。
restic_discard_cron_stdout: false
定义是否将cronjob的输出定向到/dev/null
(如果设置为false
,则每次执行时将发送电子邮件)。
restic_prometheus_exporter: true
restic_prometheus_output_path: /var/lib/node_exporter/textfile_collector
启用非常简单的Prometheus集成,将三个值写入默认的文本文件收集位置。请注意,启用此功能将安装/需要两个额外的依赖项:jq
和moreutils
(用于sponge
)。
restic_repos: []
定义一个restic作业数组。每个定义的作业将创建一个单独的包装脚本和密码文件。示例可以在defaults/main.yml中找到。
依赖项
无。
示例剧本
- hosts: all
roles:
- hadret.restic
致谢
该角色建立在donat-b/ansible-restic和paulfantom/ansible-restic的基础上。所有的molecule
测试和CI配置基于geerlingguy的工作。Prometheus集成的许多部分直接取自这个Restic论坛帖子。
许可证
MIT
作者信息
该角色由Filip Chabik于2018年组装。