combine states

This commit is contained in:
Keiran Snowden
2023-11-26 23:20:04 -05:00
parent 3de878dd20
commit c1a5c8d95b
4 changed files with 13 additions and 20 deletions

View File

@@ -11,7 +11,7 @@ restic-{{ client }}:
'download restic': 'download restic':
cmd.script: cmd.script:
- shell: /bin/bash - shell: /bin/bash
- source: salt://restic/files/install.sh.jinja - source: 'salt://restic/files/install.sh'
- templates: jinja - templates: jinja
- unless: "/bin/restic version | grep 'restic 0.16.2 '" - unless: "/bin/restic version | grep 'restic 0.16.2 '"
- env: - env:
@@ -33,42 +33,35 @@ restic-{{ client }}:
create 600 root root create 600 root root
} }
/opt/restic: restic dirs:
file.directory: file.directory:
- user: root - user: root
- group: root - group: root
- mode: 700 - mode: 700
- names:
- /opt/restic: []
- /var/log/restic: []
/opt/restic/env.sh: restic scripts:
file.managed: file.managed:
- source: 'salt://restic/files/env.sh.jinja'
- template: jinja - template: jinja
- user: root - user: root
- group: root - group: root
- mode: 700 - mode: 700
- names:
- /opt/restic/env.sh:
- source: 'salt://restic/files/env.sh'
- /opt/restic/backup.sh:
- source: 'salt://restic/files/backup.sh'
- require: - require:
- file: /opt/restic - file: /opt/restic
/opt/restic/backup.sh: restic cron:
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: cron.present:
- name: "/opt/restic/backup.sh 2>&1 >/dev/null"
- identifier: restic backup - identifier: restic backup
- minute: random - minute: random
- hour: 4 - hour: 4
- dayweek: 0 - dayweek: 0
/var/log/restic:
file.directory:
- user: root
- group: root
- mode: 700
{% endif %} {% endif %}