33 lines
957 B
Plaintext
33 lines
957 B
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
|