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/init.sls

52 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-11-03 08:35:40 +00:00
{% if pillar.restic.repository is defined %}
include:
- restic.repository
{% endif %}
Install restic packages:
pkg.installed:
- pkgs:
- restic
- restic-bash-completion
2022-11-03 12:27:06 +00:00
Create backup script for {{ pillar.restic.user }}:
2022-11-03 08:35:40 +00:00
file.managed:
- name: {{ salt['user.info'](pillar.restic.user).home }}/bin/backup.sh
- source: salt://restic/files/backup.sh.jinja
- template: jinja
- user: {{ pillar.restic.user }}
- group: root
- mode: "0740"
2022-11-03 12:27:06 +00:00
Create the restic backup service unit:
file.managed:
- name: /etc/systemd/system/restic-backup.service
- source: salt://restic/files/restic-backup.service.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
Create the restic backup timer:
file.managed:
- name: /etc/systemd/system/restic-backup.timer
- source: salt://restic/files/restic-backup.timer.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
Run systemctl daemon reload for restic:
cmd.run:
- name: systemctl daemon-reload
- onchanges:
- file: Create the restic backup service unit
- file: Create the restic backup timer
Start the restic backup timer:
service.running:
- name: restic-backup.timer
- enable: True
- onchanges:
- cmd: Run systemctl daemon reload for restic