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/podman/mariadb.sls
2022-11-04 09:10:35 +01:00

53 lines
1.3 KiB
Plaintext

{% from 'lib.sls' import container_deploy with context %}
{% set user = salt['pillar.get']('podman:user', 'root') %}
{% set home = salt['user.info'](user).home %}
Create backup destination for mariadb backups:
file.directory:
- name: {{ pillar.containers.mariadb.backup_dir }}
- user: {{ user }}
- group: root
- mode: "0750"
Create backup script:
file.managed:
- name: {{ home }}/bin/mysql-dump.sh
- source: salt://podman/files/mysql-dump.sh.jinja
- template: jinja
- user: {{ user }}
- group: root
- mode: "0700"
Create mariadb dump service:
file.managed:
- name: /etc/systemd/system/mysql-dump.service
- source: salt://podman/files/mysql-dump.service.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
Create mariadb dump timer:
file.managed:
- name: /etc/systemd/system/mysql-dump.timer
- source: salt://podman/files/mysql-dump.timer.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
Reload systemd daemon for mariadb dump:
cmd.run:
- name: systemctl daemon-reload
- onchanges:
- file: Create mariadb dump service
- file: Create mariadb dump timer
Start mariadb dump timer:
service.running:
- name: mysql-dump.timer
- enable: True
{{ container_deploy('mariadb') }}