Browse Source

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>
changes/84/637384/8
Paul Belanger 3 years ago
parent
commit
2d51431488
  1. 35
      config/borgmatic/config.yaml.j2
  2. 17
      inventory/testing/group_vars/all.yaml
  3. 2
      inventory/testing/group_vars/borg.yaml
  4. 7
      playbooks/borg-client.yaml

35
config/borgmatic/config.yaml.j2

@ -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

17
inventory/testing/group_vars/all.yaml

@ -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"

2
inventory/testing/group_vars/borg.yaml

@ -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"

7
playbooks/borg-client.yaml

@ -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

Loading…
Cancel
Save