Add variables to configure automysqlbackup
Translate Readme
This commit is contained in:
parent
b229f5811f
commit
64dcfb2fbd
4 changed files with 50 additions and 24 deletions
30
README.md
30
README.md
|
@ -1,25 +1,31 @@
|
||||||
MariaDB
|
MariaDB
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Diese Rolle installiert MariaDB, inkl.
|
This role installs MariaDB, including:
|
||||||
- Monit-Überwachung
|
- Monitoring with Monit and Munin
|
||||||
- Munin-Überwachung
|
- Backups with automysqlbackup
|
||||||
- lokale Backups mit 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 | Address to bind the MariaDB server to |
|
||||||
| bind_address | string | Listen-Adresse des Mariadb-Servers, wird bisher nicht konfiguriert |
|
|
||||||
|
|
||||||
Beispiel:
|
Ecample:
|
||||||
```YAML
|
```YAML
|
||||||
mariadb:
|
mariadb:
|
||||||
local_backupdir: /var/lib/backups/mariadb
|
|
||||||
bind_address: "10.0.0.2"
|
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 |
|
||||||
|
|
|
@ -10,3 +10,5 @@ mysql_socket: /run/mysqld/mysqld.sock
|
||||||
slowlog_query_log_file: /var/log/mysql/mariadb-slow.logA
|
slowlog_query_log_file: /var/log/mysql/mariadb-slow.logA
|
||||||
slowlog_query_time: 10
|
slowlog_query_time: 10
|
||||||
slowlog_log_slow_rate_limit: 1000
|
slowlog_log_slow_rate_limit: 1000
|
||||||
|
|
||||||
|
automysqlbackup_postbackup: /usr/local/bin/automysqlbackup_post_script
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: "Backup | Set automysqlbackup postbackup script"
|
- name: "Backup | Copy automysqlbackup configuration"
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.template:
|
||||||
path: /etc/default/automysqlbackup
|
src: automysqlbackup
|
||||||
regexp: '^#POSTBACKUP='
|
dest: /etc/default/automysqlbackup
|
||||||
line: POSTBACKUP="/usr/local/bin/automysqlbackup_post_script"
|
mode: 0644
|
||||||
|
|
||||||
- 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 postbackup script"
|
- name: "Backup | Copy automysqlbackup postbackup script"
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: automysqlbackup_post_script
|
src: automysqlbackup_post_script
|
||||||
dest: /usr/local/bin/
|
dest: "{{ automysqlbackup_postbackup }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
24
templates/automysqlbackup
Normal file
24
templates/automysqlbackup
Normal 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=""
|
Loading…
Reference in a new issue