52 lines
1.3 KiB
Plaintext
52 lines
1.3 KiB
Plaintext
{% if pillar.restic.repository is defined %}
|
|
include:
|
|
- restic.repository
|
|
{% endif %}
|
|
|
|
Install restic packages:
|
|
pkg.installed:
|
|
- pkgs:
|
|
- restic
|
|
- restic-bash-completion
|
|
|
|
Create backup script for {{ pillar.restic.user }}:
|
|
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"
|
|
|
|
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
|