Add variables to configure automysqlbackup

Translate Readme
This commit is contained in:
phil 2023-03-10 20:14:32 +01:00
parent b229f5811f
commit 64dcfb2fbd
4 changed files with 50 additions and 24 deletions

View file

@ -1,25 +1,31 @@
MariaDB
=======
Diese Rolle installiert MariaDB, inkl.
- Monit-Überwachung
- Munin-Überwachung
- lokale Backups mit automysqlbackup
This role installs MariaDB, including:
- Monitoring with Monit and Munin
- Backups with automysqlbackup
Eine Einrichtung des Datenbankservers erfolgt nicht.
No configuration of the database server will take place.
## Verfügbare Variablen
## Variables
Folgende Variablen können über die jeweilige `host_vars` im Dictionary `mariadb` gesetzt werden:
You can use the following variables to adopt the role to your needs. Place them in a dictionary called `mariadb`:
| Varible | Wert | Beschreibung |
| Varible | Value | Notes |
|--|--|--|
| local_backupdir | string | Lokales Verzeichnis der sql-Backups |
| bind_address | string | Listen-Adresse des Mariadb-Servers, wird bisher nicht konfiguriert |
| `bind_address` | string | Address to bind the MariaDB server to |
Beispiel:
Ecample:
```YAML
mariadb:
local_backupdir: /var/lib/backups/mariadb
bind_address: "10.0.0.2"
```
There are additional variables to configure automysqlbackup:
| Varibles | Defaults | Notes |
|--|--|--|
| `automysqlbackup_backupdir` | `/var/lib/automysqlbackup` | Directory to save backups |
| `automysqlbackup_dbhost` | `localhost` | Database host |
| `automysqlbackup_mailaddr` | `root` | Mail address to send reports to |
| `automysqlbackup_postbackup` | `/usr/local/bin/automysqlbackup_post_script` | Complete path to a post backup script |

View file

@ -10,3 +10,5 @@ mysql_socket: /run/mysqld/mysqld.sock
slowlog_query_log_file: /var/log/mysql/mariadb-slow.logA
slowlog_query_time: 10
slowlog_log_slow_rate_limit: 1000
automysqlbackup_postbackup: /usr/local/bin/automysqlbackup_post_script

View file

@ -1,18 +1,12 @@
---
- name: "Backup | Set automysqlbackup postbackup script"
ansible.builtin.lineinfile:
path: /etc/default/automysqlbackup
regexp: '^#POSTBACKUP='
line: POSTBACKUP="/usr/local/bin/automysqlbackup_post_script"
- name: "Backup | Dest automysqlbackup backupdir"
ansible.builtin.lineinfile:
path: /etc/default/automysqlbackup
regexp: '^BACKUPDIR='
line: 'BACKUPDIR="{{ mariadb.local_backupdir | default("/var/lib/automysqlbackup") }}"'
- name: "Backup | Copy automysqlbackup configuration"
ansible.builtin.template:
src: automysqlbackup
dest: /etc/default/automysqlbackup
mode: 0644
- name: "Backup | Copy automysqlbackup postbackup script"
ansible.builtin.copy:
src: automysqlbackup_post_script
dest: /usr/local/bin/
dest: "{{ automysqlbackup_postbackup }}"
mode: 0755

24
templates/automysqlbackup Normal file
View file

@ -0,0 +1,24 @@
# Managed by ansible
DBHOST={{ automysqlbackiup_dbhost | default("localhost") }}
DBNAMES=`mysql --defaults-file=/etc/mysql/debian.cnf --execute="SHOW DATABASES" | awk '{print $1}' | grep -v ^Database$ | grep -v ^mysql$ | grep -v ^performance_schema$ | grep -v ^information_schema$ | tr \\\r\\\n ,\ `
BACKUPDIR="{{ automysqlbackup_backupdir | default("/var/lib/automysqlbackup") }}"
MAILCONTENT="quiet"
MAXATTSIZE="4000"
MAILADDR="{{ automysqlbackup_mailaddr | default(root) }}"
MDBNAMES="mysql $DBNAMES"
DBEXCLUDE=""
CREATE_DATABASE=yes
SEPDIR=yes
DOWEEKLY=6
DOMONTHLY=01
COMP=gzip
COMPDIRECT=no
COMMCOMP=no
LATEST=no
MAX_ALLOWED_PACKET=
SOCKET=
PREBACKUP=
POSTBACKUP="{{ automysqlbackup_postbackup }}"
ROUTINES=yes
OPTIONS=""