Konfiguriere Backup

This commit is contained in:
phil 2021-05-26 07:36:55 +02:00
parent fa35d7fa68
commit 2c4b2463c4
4 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,11 @@
source /etc/default/automysqlbackup
# available variables:
# strings, i.e. character sequences
echo "$BACKUPDIR"
[ -z "$BACKUPDIR" ] && echo >&2 "Invalid / unknown BACKUPDIR" && exit 1
# Loeschen der alten Backups
find "${BACKUPDIR}/monthly" "${BACKUPDIR}/weekly" "${BACKUPDIR}/daily" -type f -mtime +5 -delete

View file

@ -4,4 +4,5 @@
- import_tasks: packages.yml - import_tasks: packages.yml
- import_tasks: munin.yml - import_tasks: munin.yml
- import_tasks: cron.yml - import_tasks: cron.yml
- import_tasks: mariadb.yml

17
tasks/mariadb.yml Normal file
View file

@ -0,0 +1,17 @@
---
- name: "mariadb: Richte automysqlbackup ein"
lineinfile:
path: /etc/default/automysqlbackup
regexp: '^#POSTBACKUP='
line: POSTBACKUP="{{ scripts_path }}/automysqlbackup_post_script"
- name: "mariadb: Erstelle scripts-Verzeichnis"
file:
path: "{{ scripts_path }}"
state: directory
- name: "mariadb: Richte Backup ein 2"
copy:
src: automysqlbackup_post_script
dest: "{{ scripts_path }}/automysqlbackup_post_script"
mode: 0755

View file

@ -6,6 +6,7 @@
- name: "Packages: MariaDB-Server installieren" - name: "Packages: MariaDB-Server installieren"
apt: apt:
pkg: pkg:
- automysqlbackup
- default-mysql-server - default-mysql-server
- libcache-cache-perl - libcache-cache-perl
- python-pymysql - python-pymysql