Skip to content

Commit 3209751

Browse files
stegmatzem3nu
authored andcommitted
Add option to add flags to borgmatic in cron/systemd-timer job
1 parent 4c7f8d8 commit 3209751

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/ansibl
110110
- `borgmatic_config_name`: Name to use for the Borgmatic config file. Defaults to `config.yaml`
111111
- `borgmatic_timer_hour`: Hour when regular create and prune cron/systemd-timer job will run. Defaults to `{{ 6 | random }}`
112112
- `borgmatic_timer_minute`: Minute when regular create and prune cron/systemd-timer job will run. Defaults to `{{ 59 | random }}`
113+
- `borgmatic_timer_flags`: Flags to pass to borgmatic cron/systemd-timer job, like "--log-file /path/to/file.log --log-file-verbosity 2"
113114
- `borgmatic_hooks`: Hooks to monitor your backups e.g. with [Healthchecks](https://healthchecks.io/). See [official documentation](https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/) for more.
114115
- `borgmatic_timer`: If the variable is set, a timer is installed. A choice must be made between `cron` and `systemd`.
115116
- `borgmatic_relocated_repo_access_is_ok`: Bypass Borg error about a repository that has been moved. Defaults to `false`

defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ borgmatic_timer_cron_name: "borgmatic"
2222
borgmatic_timer: cron
2323
borgmatic_timer_hour: "{{ range(0, 5) | random(seed=inventory_hostname) }}"
2424
borgmatic_timer_minute: "{{ range(0, 59) | random(seed=inventory_hostname) }}"
25+
borgmatic_timer_flags: ""
2526
borg_install_method: "pip"
2627
borg_require_epel: "{{ ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' }}"
2728

meta/argument_specs.yml

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ argument_specs:
180180
type: str
181181
required: false
182182
description: Minute when regular create and prune cron/systemd-timer job will run.
183+
borgmatic_timer_flags:
184+
type: str
185+
required: false
186+
description: Flags to pass to borgmatic cron/systemd-timer job, like "--log-file /path/to/file.log --log-file-verbosity 2"
183187
borgmatic_version:
184188
type: str
185189
required: false

tasks/noauto_create_timer_cron.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
minute: "{{ borgmatic_timer_minute }}"
1414
user: "{{ borg_user }}"
1515
cron_file: "{{ borgmatic_timer_cron_name }}"
16-
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
16+
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} {{ borgmatic_timer_flags }}"
1717

1818
- name: Ensure separate check cron job is absent
1919
cron:

templates/borgmatic.service.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ConditionACPower=true
1212
[Service]
1313
Type=oneshot
1414
User={{ borg_user }}
15-
ExecStart=borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}
15+
ExecStart=borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} {{ borgmatic_timer_flags }}
1616

1717
# Source: https://projects.torsion.org/borgmatic-collective/borgmatic/raw/branch/master/sample/systemd/borgmatic.service
1818
# Security settings for systemd running as root, optional but recommended to improve security. You

0 commit comments

Comments
 (0)