我的主机没有稳定的主机名,但有预定义的 IP 范围。
如何为 Ansible list 文件设置 IP 范围?
我正在尝试设置这样的东西:
test.ini:
[database]
db ansible_ssh_host=1.1.1.[20:25] ansible_ssh_port=22
[lemp]
lemp ansible_ssh_host=1.1.1.[10:15] ansible_ssh_port=22
现在我在运行 ansible-playbook -i test.ini
后得到这个错误:
fatal: [db] => SSH Error: ssh: Could not resolve hostname 1.1.1.[20:25]: Name or service not known
最佳答案
我为我的问题找到了这个有效的解决方案:
test.ini:
# I removed hostname section and ansible_ssh_host=
10.0.3.[20:25] ansible_ssh_port=22
关于ansible - 具有 IP 范围的主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33648627/