Files
xinfra/ansible/inventory.example.yml
T

36 lines
1.4 KiB
YAML
Raw Normal View History

# =============================================================================
# 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 默认位置)