This repository has been archived on 2023-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
salt-states_old/restic/repository.sls

33 lines
957 B
Plaintext
Raw Permalink Normal View History

2022-11-03 08:35:40 +00:00
{% set escape_command = [ "systemd-escape -p", pillar['restic']['mount']]|join(" ") %}
2022-11-02 12:51:59 +00:00
{% 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
2022-11-30 08:12:46 +00:00
Start restic repository automount unit:
service.running:
- name: {{ unit_name }}.automount
- enable: True