Initialize an empty borg repository

This is the next step to get borgbackup / borgmatic working.

Change-Id: Ib1dc15fbd251262cf527a7cec8e86d9212e65fbb
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-02-16 11:44:31 -05:00
parent bd4f3bbdad
commit 2d51431488
4 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# 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
# Paths to local or remote repositories.
repositories:
{% if 'borg-server' in groups %}
{% for host in groups['borg-server'] %}
- borg_{{ inventory_hostname }}@{{ hostvars[host].ansible_host }}:backup.borg
{% endfor %}
{% endif %}
local_path: {{ borgbackup_pip_virtualenv }}/bin/borg
storage:
# WARNING! Be sure to change this value, otherwise when you initialize
# a borg repo, it will default to public secret!
encryption_passphrase: SuperSecretPassphrase
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

View File

@ -0,0 +1,17 @@
# 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.
---
# windmill-config
# TODO(pabelanger): Create windmill-config project on git.o.o.
windmill_config_git_dest: "{{ lookup('pipe', 'pwd') | dirname }}/config"

View File

@ -22,3 +22,5 @@ borgmatic_pip_virtualenv: /opt/venv/borgmatic
borgmatic_user_name: borgbackup
borgmatic_user_group: borgbackup
borgmatic_user_home: /var/lib/borgbackup
borgmatic_file_config_yaml_src: "{{ windmill_config_git_dest }}/borgmatic/config.yaml.j2"

View File

@ -71,3 +71,10 @@
ssh_user_group: borgbackup
with_inventory_hostnames:
- borg-server:!disabled
- name: Initialize an empty borg repository
become: true
become_user: borgbackup
command: "{{ borgmatic_pip_virtualenv }}/bin/borgmatic --init --encryption repokey"
register: r
changed_when: r.stderr | length > 0