78 lines
1.8 KiB
Plaintext
78 lines
1.8 KiB
Plaintext
{%- if pillar['containers']['mariadb'] is defined %}
|
|
Create mariadb dump script:
|
|
file.managed:
|
|
- name: /root/bin/mysql-backup.sh
|
|
- source: salt://restic/files/mysql-backup.sh
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- mode: "0700"
|
|
|
|
Create backup destination for mariadn:
|
|
file.directory:
|
|
- name: {{ pillar.containers.mariadb.backup_dir }}
|
|
- user: root
|
|
- group: root
|
|
- mode: "0700"
|
|
|
|
{%- endif %}
|
|
|
|
Create restiv password-file:
|
|
file.managed:
|
|
- name: /root/.restic.password
|
|
- contents:
|
|
- {{ pillar.restic.password }}
|
|
- user: root
|
|
- group: root
|
|
- mode: "0600"
|
|
|
|
Create restic script:
|
|
file.managed:
|
|
- name: /usr/local/bin/restic
|
|
- source: salt://restic/files/restic.jinja
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- mode: "0755"
|
|
|
|
Create backup script:
|
|
file.managed:
|
|
- name: /root/bin/backup.sh
|
|
- source: salt://restic/files/backup.sh.jinja
|
|
- template: jinja
|
|
- user: root
|
|
- group: root
|
|
- mode: "0700"
|
|
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
|
|
|