added restic repository state
This commit is contained in:
parent
20c3717a10
commit
e7626bdedc
8
restic/files/restic.automount.jinja
Normal file
8
restic/files/restic.automount.jinja
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Automount for restic repository
|
||||||
|
|
||||||
|
[Automount]
|
||||||
|
Where={{ pillar['restic']['repository']['mount'] }}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
11
restic/files/restic.mount.jinja
Normal file
11
restic/files/restic.mount.jinja
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Mount the USB disk used as restic repository
|
||||||
|
|
||||||
|
[Mount]
|
||||||
|
What=/dev/disk/by-uuid/{{ pillar['restic']['repository']['disk_uuid'] }}
|
||||||
|
Where={{ pillar['restic']['repository']['mount'] }}
|
||||||
|
Type=auto
|
||||||
|
Options=defaults
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
27
restic/repository.sls
Normal file
27
restic/repository.sls
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{% set escape_command = [ "systemd-escape -p", pillar['restic']['repository']['mount']]|join(" ") %}
|
||||||
|
{% set unit_name = salt['cmd.shell'](escape_command) %}
|
||||||
|
|
||||||
|
Create restic repository mount unit:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/systemd/system/{{ unit_name }}.mount
|
||||||
|
- source: salt://restic/files/restic.mount.jinja
|
||||||
|
- template: jinja
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0644"
|
||||||
|
|
||||||
|
Create restic repository automount unit:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/systemd/system/{{ unit_name }}.automount
|
||||||
|
- source: salt://restic/files/restic.automount.jinja
|
||||||
|
- template: jinja
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0644"
|
||||||
|
|
||||||
|
Run systemd daemon reload for repository:
|
||||||
|
cmd.run:
|
||||||
|
- name: systemctl daemon-reload
|
||||||
|
- onchanges:
|
||||||
|
- file: Create restic repository mount unit
|
||||||
|
- file: Create restic repository automount unit
|
Reference in New Issue
Block a user