# Ansible Inventory 示例文件 # 复制此文件为 inventory.ini 并修改为你的实际服务器信息 [nezha_agents] # 单个服务器示例 server1.example.com ansible_host=192.168.1.10 ansible_user=root # 多个服务器 server2.example.com ansible_host=192.168.1.11 ansible_user=admin ansible_become=yes server3.example.com ansible_host=192.168.1.12 ansible_user=admin ansible_become=yes # 使用不同的 SSH 端口 server4.example.com ansible_host=192.168.1.13 ansible_port=2222 ansible_user=root [nezha_agents:vars] # 组级别的变量 ansible_python_interpreter=/usr/bin/python3 # 如果使用 SSH 密钥 # ansible_ssh_private_key_file=~/.ssh/id_rsa # 测试环境 [test_servers] test1.example.com ansible_host=192.168.10.10 # 生产环境 [prod_servers] prod1.example.com ansible_host=192.168.20.10 prod2.example.com ansible_host=192.168.20.11 prod3.example.com ansible_host=192.168.20.12 # 所有服务器 [all:children] nezha_agents test_servers prod_servers