[apidb]
1.1.1.1:60362
1.1.1.1:60366
[apiredis]
1.1.1.1:60367
1.1.1.1:60368
1.1.1.1:60361
1.1.1.1:64089
[apitomcat]
1.1.1.1:22
1.1.1.1:61075
1.1.1.1:61346
1.1.1.1:57737
[api-tcpping]
1.1.1.1:64092
请问这种情况hosts文件该怎么写
现在这种写法只执行第一个

解决方案 »

  1.   

    ansible 自动化管理 hosts文件 里面机器IP都是一个,ssh端口不同,在执行命令的时候只执行第一台服务器
      

  2.   

    ssh免登录已经做了
      

  3.   

    启动的yml文件贴出来看看呢
      

  4.   

    host文件这样写
    [port]
    192.168.3.102
    [port:vars]
    ansible_ssh_user=”user”
    ansible_ssh_port=65535
      

  5.   

    [servers1]
    server-name-1 ansible_host=clientA.domain.com ansible_user=username ansible_port=1111
    [servers2]
    server-name-2 ansible_host=clientA.domain.com ansible_user=username ansible_port=2222
    [servers3]
    server-name-3 ansible_host=clientA.domain.com ansible_user=username ansible_port=3333hosts配置文件按如上格式编写