mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 19:54:32 +00:00
- Added tasks and playbooks for K3s datastore export/import using MariaDB Tools role, with associated tests and defaults. - Enhanced iSCSI role to support mkfs-once logic and safer re-initialization of block storage. - Migrated iSCSI-backed Rancher data from retropie to merlin.prole.org. - Updated k3s roles/playbooks to relax Rancher storage preflight checks, supporting PARTUUID-based mounts. - Adjusted Samba AD NetBIOS name derivation to use uppercase short hostname by default. - Incremented prole DB version to 104, updated generated prole.cfg, inventory, and recovery manifest templates.
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
SRC_HOST="synology.prole.org"
|
||
SRC_PORT="3306"
|
||
SRC_DB="k3s"
|
||
SRC_USER="root"
|
||
DB_PASSWORD='7EAs3!kF2!7eQypP'
|
||
|
||
OUT_DIR="${1:-$PWD}"
|
||
TS="$(date +%Y%m%d-%H%M%S)"
|
||
OUT_FILE="${OUT_DIR%/}/k3s-datastore-${SRC_HOST}-${TS}.sql"
|
||
|
||
DUMP_BIN="${DUMP_BIN:-mysqldump}" # or mariadb-dump if that’s what you have
|
||
|
||
extra=()
|
||
# MySQL 8 client compat (harmless if absent)
|
||
if "${DUMP_BIN}" --help 2>/dev/null | grep -q -- '--column-statistics'; then
|
||
extra+=(--column-statistics=0)
|
||
fi
|
||
# Some clients support it; some MariaDB builds don’t. Only add when supported.
|
||
if "${DUMP_BIN}" --help 2>/dev/null | grep -q -- '--set-gtid-purged'; then
|
||
extra+=(--set-gtid-purged=OFF)
|
||
fi
|
||
|
||
# IMPORTANT for your Ansible import role’s safety check:
|
||
# - do NOT use --databases / --all-databases (those emit CREATE DATABASE)
|
||
# - dump exactly one DB (k3s), so any USE statement matches the target DB
|
||
MYSQL_PWD="${DB_PASSWORD}" "${DUMP_BIN}" \
|
||
--protocol=tcp \
|
||
--host="${SRC_HOST}" \
|
||
--port="${SRC_PORT}" \
|
||
--user="${SRC_USER}" \
|
||
--default-character-set=utf8mb4 \
|
||
--single-transaction \
|
||
--quick \
|
||
--routines \
|
||
--events \
|
||
--triggers \
|
||
--skip-lock-tables \
|
||
--skip-add-locks \
|
||
--hex-blob \
|
||
"${extra[@]}" \
|
||
"${SRC_DB}" \
|
||
>"${OUT_FILE}"
|
||
|
||
chmod 0600 "${OUT_FILE}"
|
||
echo "Wrote: ${OUT_FILE}"
|