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

53 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-11-02 10:18:20 +00:00
{% from 'lib.sls' import container_deploy with context %}
2022-11-04 08:10:35 +00:00
{% 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
2022-11-02 10:18:20 +00:00
{{ container_deploy('mariadb') }}