Ansible wait_for模块不适用于telnet

时间:2019-05-17 22:28:44

标签: ansible ansible-2.x ansible-inventory ansible-facts

我正在学习ansible,并且我正在使用 wait_for 模块将远程主机的telnet连接到另一主机。在运行剧本时,我将提供主IP。

 ansible-playbook example.yml --extra-vars "master_ip=1.1.1.1"



- name: checking the master connection
  wait_for:
    host: "{{ master_ip }}"
    port: 5985
    timeout: 10
    state: started
    msg: Can't connect to master  server

但是下面的错误显示了ansible:

fatal: [remote_host_ip]: FAILED! => {"changed": false, "elapsed": 11, "msg": "Can't connect to master server"}

但是,当我手动登录到 remote_host_ip 并使用telnet访问 master_ip 时,它起作用了。

telnet master_ip 5985
Trying master_ip...
Connected to master_ip
Escape character is '^]'.

我们将不胜感激,或者如果有更好的方法使用ansible从远程主机到另一台主机进行telnet,那么

0 个答案:

没有答案
相关问题