Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ borg_user: "root"
borg_group: "root"
backup_user_info:
home: "/home/{{ borg_user }}"
borgmatic_run_as_root: false
...
4 changes: 4 additions & 0 deletions meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,7 @@ argument_specs:
type: str
required: false
description: Comment added to the SSH public key.
borgmatic_run_as_root:
type: bool
required: false
description: If the variable is set, systemd will run borgmatic using sudo.
2 changes: 1 addition & 1 deletion templates/borgmatic.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ConditionACPower=true
[Service]
Type=oneshot
User={{ borg_user }}
ExecStart=borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} {{ borgmatic_timer_flags }}
ExecStart={{ 'sudo ' if borgmatic_run_as_root}}borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} {{ borgmatic_timer_flags }}

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