c26790f84b
- mysql-deploy.yml: 为所有变量、任务、handlers 添加中文注释,解释参数含义、设计逻辑和平台契约 - mysql-delivery@.service: 为 Systemd 模板单元添加中文注释,说明 %i 参数机制、Type=notify、OOMScoreAdjust 等配置项 - mysql-instance.cnf.j2: 为 MySQL 配置模板添加中文注释,说明各参数含义、版本差异、复制配置逻辑 - inventory.example.yml: 为 Inventory 示例添加中文注释,说明主机组与拓扑对应关系及使用方式
36 lines
1.4 KiB
YAML
36 lines
1.4 KiB
YAML
# =============================================================================
|
|
# Ansible Inventory 示例文件
|
|
# =============================================================================
|
|
# Inventory 定义了要管理的主机列表和分组
|
|
# 实际使用时,平台会动态生成 inventory 并传入变量
|
|
#
|
|
# 使用方式:
|
|
# ansible-playbook -i inventory.example.yml mysql-deploy.yml \
|
|
# -e "target_hosts=mysql_hosts" \
|
|
# -e "instance_name=db01" \
|
|
# -e "topology=mgr_3" \
|
|
# -e "mysql_version=8.0" \
|
|
# -e "memory_mb=8192" \
|
|
# -e "storage_gb=100"
|
|
# =============================================================================
|
|
|
|
all:
|
|
children:
|
|
# --- MySQL 主机组 ---
|
|
# 按拓扑需求选择对应数量的主机:
|
|
# standalone = 1 台
|
|
# primary_replica = 2 台(一主一从)
|
|
# mgr_3 = 3 台(三节点组复制)
|
|
mysql_hosts:
|
|
hosts:
|
|
# 格式:主机名: { ansible_host: IP地址 }
|
|
k8s-server-01: { ansible_host: 192.168.1.4 }
|
|
k8s-server-02: { ansible_host: 192.168.1.5 }
|
|
k8s-server-03: { ansible_host: 192.168.1.2 }
|
|
k8s-worker-01: { ansible_host: 192.168.1.3 }
|
|
|
|
# --- 全局变量 ---
|
|
vars:
|
|
ansible_user: root # SSH 登录用户(需要 root 权限执行系统级操作)
|
|
ansible_python_interpreter: /usr/bin/python3 # Python 解释器路径(Ubuntu 默认位置)
|