Commit Graph

12 Commits

Author SHA1 Message Date
Hungerdream 454df86021 fix(ansible): 一主多从从库强制只读
- mysql-instance.cnf.j2 按 mysql_node_role=replica 注入 read-only/super-read-only,
  阻止业务直接写入从库导致主从数据分叉(复制线程与复制管理语句不受影响)
- 账号配置任务在从库上临时放开只读、配置完成后回锁,
  避免 cnf 只读拒绝 ALTER/CREATE USER;主库与 standalone 不受影响
2026-07-31 18:49:21 +08:00
Hungerdream 69a12d778e feat(ansible): MySQL 交付剧本接入 GTID 异步主从复制
- mysql_expected_hosts 按 replica_count 推导预期节点数
- 主节点判定改为 mysql_primary_host 显式指定,IP 经 hostvars 回退解析
- 副本节点等待主节点端口就绪后执行 CHANGE REPLICATION SOURCE
  (defaults-extra-file 临时凭据文件 + SOURCE_AUTO_POSITION + GET_SOURCE_PUBLIC_KEY)
- 复制线程验证含 IO/SQL Running 与错误字段空值检查
  (锚点带 ^[[:space:]]* 适配 SHOW REPLICA STATUS\G 的字段名前导空格)
2026-07-31 18:12:15 +08:00
Hungerdream b3eb10a81d fix(ansible): reload systemd daemon before restarting delivery instance
Ensure updated mysql-delivery@.service unit definitions are picked up
by running daemon-reload before the instance restart in both delivery
playbooks.
2026-07-29 18:39:37 +08:00
Hungerdream ef6508938c feat(delivery): switch to a single root@% admin account model
- CreateTask now accepts only mysql_root_password; drop
  mysql_admin_password and the paired root/admin validation,
  keeping the >=16-char length and alphanumeric-only checks
- deploymentCredentialVars extracts mysql_root_password only,
  remaining compatible with legacy root@localhost records
- Both delivery playbooks drop xinfra_admin provisioning and
  the mysql_admin_password assertion, creating 'root'@'%'
  as the remote admin account instead
2026-07-29 18:39:37 +08:00
Hungerdream e30f547891 fix(ansible): harden mysql data_disk path validation
Reject bare '/', path traversal ('..') and duplicated slashes ('//') in mysql_data_disk assertions to avoid deploying into unsafe directories.
2026-07-28 19:14:50 +08:00
mac f7be87c7d9 feat: wire delivery result and infra data backends 2026-07-28 17:56:00 +08:00
mac 8e09c30d21 feat: wire mysql delivery to awx callbacks 2026-07-28 14:45:17 +08:00
Hungerdream bfb4f0df4d feat(delivery): complete MySQL version-to-package mapping
- 8.0 from Ubuntu archive, 8.4 from MySQL official APT repo
- 5.6/5.7 not supported for now; enforce one MySQL series per host
- Sync Go version whitelist with the playbook package map
2026-07-27 15:18:54 +08:00
Hungerdream e8e9612527 fix(ansible): use dict-form shell tasks with explicit bash
Free-form split_args breaks on quotes/Jinja at AWX runtime,
and default dash rejects pipefail.
2026-07-27 15:17:46 +08:00
Hungerdream 3c3645f8d5 feat(delivery): extend MySQL delivery parameters and tighten resource bounds
- Add topology/port/data_disk, DB options and 8 advanced parameters
  with whitelist validation, rendered via extra_vars into the playbook
- Hybrid port allocation over pool 13306-13999
- Tighten bounds: memory 2048-65536 MiB, storage 20-2000 GiB
2026-07-27 15:16:57 +08:00
mac f91df3be3d fix(delivery): address review feedback on idempotency, crash recovery, and security
- Idempotency: verify RequestedBy matches caller to prevent cross-user key reuse
- Crash recovery: persist ExecutionJob (launching) before AWX Launch, update to running after
- Terminal state: finish ExecutionJob on success/cancel/failure; failTask accepts canceling
- Reservation TTL: filter expired reservations in quota aggregation
- Ansible heredoc: use <<'EOF' to prevent shell expansion of secrets; escape single quotes
- Validation: align Go resource ranges with playbook (mem 1024-4096, storage 10-100)
- Version whitelist: only allow 8.0, pass mysql_version to AWX extra_vars; playbook selects package via map

Relates-to: #97
2026-07-23 14:39:09 +08:00
mac 5ddb434b74 feat(delivery): add Ansible playbook for native MySQL provisioning
Add mysql-deploy.yml playbook for bare-metal MySQL 8.0 delivery via
AWX: parameter validation, resource preflight checks, apt install,
AppArmor adaptation, per-instance directory layout, Jinja2 config
template (buffer pool sizing, binlog, GTID), systemd template unit
(mysql-delivery@.service), admin account setup, and TCP health
verification. Includes example inventory.

Relates-to: #97
2026-07-23 12:05:07 +08:00