Add borgmatic configuration

This is a sample configuration file that users are encouraged to modify.

Change-Id: Ifab9bd0325fb5198ccc7a91f7c101a2780744b6d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-02-13 16:50:54 -05:00
parent 7b6ee24e8c
commit b326cd6d82
4 changed files with 92 additions and 0 deletions

View File

@ -15,6 +15,19 @@
# tasks/main.yaml
borgmatic_task_manager:
- install
- config
# task/config.yaml
borgmatic_user_name: root
borgmatic_user_group: root
borgmatic_user_home: /root
borgmatic_file_config_yaml_dest:
"{{ borgmatic_user_home }}/.config/borgmatic/config.yaml"
borgmatic_file_config_yaml_group: "{{ borgmatic_user_group }}"
borgmatic_file_config_yaml_mode: 0644
borgmatic_file_config_yaml_owner: "{{ borgmatic_user_name }}"
borgmatic_file_config_yaml_src: root/.config/borgmatic/config.yaml.j2
# tasks/install.yaml
borgmatic_git_dest: "{{ ansible_user_dir }}/src/github.com/witten/borgmatic"

View File

@ -13,5 +13,23 @@
# under the License.
def test_borgmatic_config(host):
f = host.file('/root/.config/borgmatic')
assert f.exists
assert f.is_directory
assert f.user == 'root'
assert f.group == 'root'
# TODO(pabelanger): Validate mode
del f
f = host.file('/root/.config/borgmatic/config.yaml')
assert f.exists
assert f.is_file
assert f.user == 'root'
assert f.group == 'root'
assert f.mode == 0o644
del f
def test_borgmatic_version(host):
host.check_output('borgmatic --version')

31
tasks/config.yaml Normal file
View File

@ -0,0 +1,31 @@
# Copyright 2019 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Create required directories
become: true
become_user: "{{ borgmatic_user_name }}"
file:
group: "{{ borgmatic_user_group }}"
owner: "{{ borgmatic_user_name }}"
path: "{{ borgmatic_user_home }}/.config/borgmatic"
state: directory
- name: Install borgmatic configuration
become: true
template:
dest: "{{ borgmatic_file_config_yaml_dest }}"
group: "{{ borgmatic_file_config_yaml_group }}"
mode: "{{ borgmatic_file_config_yaml_mode }}"
owner: "{{borgmatic_file_config_yaml_owner }}"
src: "{{ borgmatic_file_config_yaml_src }}"

View File

@ -0,0 +1,30 @@
# This file is generated by Ansible
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
---
location:
# List of source directories to backup. Globs are expanded.
source_directories:
- /home
- /etc
- /var/log/syslog*
# Paths to local or remote repositories.
repositories:
- user@backupserver:sourcehostname.borg
# Any paths matching these patterns are excluded from backups.
exclude_patterns:
- /home/*/.cache
retention:
# Retention policy for how many backups to keep in each category.
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
consistency:
# List of consistency checks to run: "repository", "archives", or both.
checks:
- repository
- archives