restic formula rewrite and gitea updates

This commit is contained in:
Keiran Snowden
2023-11-26 21:56:18 -05:00
parent 0bb12fde34
commit 3de878dd20
13 changed files with 154 additions and 84 deletions

74
restic/init.sls Normal file
View File

@@ -0,0 +1,74 @@
{% for client in salt.pillar.get("restic:server:clients", []) %}
restic-{{ client }}:
user.present:
- home: {{ salt.pillar.get("restic:server:mount") }}/{{ client }}
- createhome: true
- system: true
{% endfor %}
{% if salt.pillar.get("restic:client", None) is not none %}
{% if salt.pillar.get("restic:client:install", True)%}
'download restic':
cmd.script:
- shell: /bin/bash
- source: salt://restic/files/install.sh.jinja
- templates: jinja
- unless: "/bin/restic version | grep 'restic 0.16.2 '"
- env:
- RESTIC_VERSION: 0.16.2
{% endif %}
/etc/logrotate.d/restic-backup:
file.managed:
- user: root
- group: root
- mode: 644
- contents: |
/var/log/restic/backup.log {
monthly
rotate 3
compress
missingok
notifempty
create 600 root root
}
/opt/restic:
file.directory:
- user: root
- group: root
- mode: 700
/opt/restic/env.sh:
file.managed:
- source: 'salt://restic/files/env.sh.jinja'
- template: jinja
- user: root
- group: root
- mode: 700
- require:
- file: /opt/restic
/opt/restic/backup.sh:
file.managed:
- source: 'salt://restic/files/backup.sh.jinja'
- template: jinja
- user: root
- group: root
- mode: 700
- require:
- file: /opt/restic
"/opt/restic/backup.sh 2>&1 >/dev/null":
cron.present:
- identifier: restic backup
- minute: random
- hour: 4
- dayweek: 0
/var/log/restic:
file.directory:
- user: root
- group: root
- mode: 700
{% endif %}