Add RHEL9 support, fix empty exclude option (#92)

This commit is contained in:
Manu 2022-02-20 13:56:14 +04:00 committed by GitHub
parent 4e376b4442
commit bb5b6afd4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 14 deletions

View File

@ -3,6 +3,7 @@ borg_encryption_passphrase: ''
borg_exclude_patterns: []
borgmatic_config_name: config.yaml
borgmatic_large_repo: true
borgmatic_hooks: []
borgmatic_failure_command:
- echo "`date` - Error while creating a backup."
borgmatic_before_backup_command:
@ -15,7 +16,6 @@ borgmatic_check_last: 3
borgmatic_store_atime: true
borgmatic_store_ctime: true
borgmatic_relocated_repo_access_is_ok: false
borgmatic_hooks: []
borg_one_file_system: true
borg_exclude_from: []
borg_encryption_passcommand: false

View File

@ -31,3 +31,9 @@
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
post_tasks:
- name: Install yamllint for checking config file
pip:
name: yamllint
executable: pip3

View File

@ -8,14 +8,12 @@ platforms:
image: archlinux:latest
- name: centos-7
image: centos:7
- name: centos-8
image: centos:8
- name: almalinux-8
image: almalinux:8
- name: fedora-latest
image: fedora:latest
- name: debian-bullseye
image: debian:bullseye
- name: debian-buster
image: debian:buster
- name: ubuntu-bionic
image: ubuntu:bionic
- name: ubuntu-latest

View File

@ -2,6 +2,12 @@
- name: Verify
hosts: all
tasks:
- name: Example assertion
assert:
that: true
- name: Ensure Borgmatic is installed correctly
command: borgmatic --version
- name: Ensure Borg is installed correctly
command: borgmatic borg --version
- name: Ensure produced YAML is valid
command: |
yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" /etc/borgmatic/config.yaml

View File

@ -82,14 +82,14 @@
{% endif %}
when: create_repo
- name: Ensures /etc/borgmatic exists
- name: Ensure /etc/borgmatic exists
file:
path: /etc/borgmatic
state: directory
mode: 0700
owner: root
- name: Add Borgmatic Configuration
- name: Add Borgmatic configuration
template:
src: config.yaml.j2
dest: "/etc/borgmatic/{{ borgmatic_config_name }}"

View File

@ -1,4 +1,5 @@
#jinja2: lstrip_blocks: "True", trim_blocks: "True"
---
# Full config: https://torsion.org/borgmatic/docs/reference/config.yaml
location:
source_directories:
@ -23,7 +24,7 @@ location:
# Store ctime into archive.
ctime: {{ borgmatic_store_ctime }}
{% if borg_exclude_patterns|length %}
{% if borg_exclude_patterns %}
# Any paths matching these patterns are excluded from backups. Globs and tildes
# are expanded. See the output of "borg help patterns" for more details.
exclude_patterns:
@ -31,8 +32,7 @@ location:
- '{{ dir }}'
{% endfor %}
{% endif %}
{% if borg_exclude_from|length %}
{% if borg_exclude_from %}
# Read exclude patterns from one or more separate named files, one pattern per
# line. See the output of "borg help patterns" for more details.
exclude_from:
@ -196,5 +196,6 @@ hooks:
{% endfor %}
{% for hook in borgmatic_hooks %}
{{ hook }}: {{ borgmatic_hooks[hook] }}
{{ hook }}:
{{ borgmatic_hooks[hook] | to_nice_yaml(indent=2) | trim | indent(8) }}
{% endfor %}

22
vars/RedHat-9.yml Normal file
View File

@ -0,0 +1,22 @@
---
borg_packages:
- libacl-devel
- libacl
- gcc
- gcc-c++
- openssl-devel
- python3-pip
- python3-wheel
- python3-devel
- python3-setuptools
- python3-virtualenv
- openssh-clients
- cronie
python_bin: python3
pip_bin: pip3
borg_python_packages:
- cython
- borgbackup
- borgmatic