Ansible:ssh_host IP 范围在里面

Ansible: ssh_host with IP range inside

我的主机没有稳定的主机名,但有预定义的 IP 范围。 如何设置 ansible 清单文件的 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