File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,4 +50,5 @@ borg_user: "root"
5050borg_group : " root"
5151backup_user_info :
5252 home : " /home/{{ borg_user }}"
53+ borgmatic_run_as_root : false
5354...
Original file line number Diff line number Diff line change @@ -203,3 +203,7 @@ argument_specs:
203203 type : str
204204 required : false
205205 description : Comment added to the SSH public key.
206+ borgmatic_run_as_root :
207+ type : bool
208+ required : false
209+ description : If the variable is set, systemd will run borgmatic using sudo.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ ConditionACPower=true
1212[Service]
1313Type=oneshot
1414User={{ borg_user }}
15- ExecStart={{ 'sudo ' if borg_user != 'root' }}borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} {{ borgmatic_timer_flags }}
15+ ExecStart={{ 'sudo ' if borgmatic_run_as_root }}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
@@ -22,7 +22,7 @@ LockPersonality=true
2222# Certain borgmatic features like Healthchecks integration need MemoryDenyWriteExecute to be off.
2323# But you can try setting it to "yes" for improved security if you don't use those features.
2424MemoryDenyWriteExecute=no
25- NoNewPrivileges={{ 'no' if borg_user != 'root' else 'yes'}}
25+ NoNewPrivileges={{ 'no' if borgmatic_run_as_root else 'yes'}}
2626PrivateDevices=yes
2727PrivateTmp=yes
2828ProtectClock=yes
You can’t perform that action at this time.
0 commit comments