40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
{% set escape_command = [ "systemd-escape -p", pillar['restic']['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
|
|
|
|
Start restic repository automount unit:
|
|
service.running:
|
|
- name: {{ unit_name }}.automount
|
|
- enable: True
|
|
|
|
Add autherized keys for root-restic:
|
|
ssh_auth.present:
|
|
- user: root
|
|
- enc: ssh-ed25519
|
|
- comment: restic-backup
|
|
- names: {{ pillar.restic.repository.auth_keys }}
|