{% 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:
- name: /etc/systemd/system/{{ unit_name }}.automount
- source: salt://restic/files/restic.automount.jinja
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