kar*_*bar 7 ssh ansible ansible-2.x ansible-inventory
一个多月以来,我一直在运行以下命令:
ansible-playbook -vvvvi host_test rhel-tests.yml
Run Code Online (Sandbox Code Playgroud)
它通过 SSH 连接并在主机上成功运行测试,没有任何问题。但截至最近几天,我在运行时收到以下信息:
fatal: [10.2.16.2]: UNREACHABLE! => {
"changed": false,
"unreachable": true
}
MSG:
Failed to connect to the host via ssh: OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 35742
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Control master terminated unexpectedly
Shared connection to 10.2.16.2 closed.
Run Code Online (Sandbox Code Playgroud)
即使我可以从我正在运行的主机上建立从 bash 到 10.2.16.2 的正常 SSH 连接也很好。
内容host_test如下:
[rhel]
10.2.16.2 node_type=xxx
[rhel:vars]
ansible_become=yes
ansible_become_method=su
ansible_become_user=root
ansible_connection=ssh
ansible_user=yyy
node_name=""
[cisco]
[cisco:vars]
node_name=""
[curtiss-wright]
[zzz]
[other]
[nmap:children]
rhel
cisco
curtiss-wright
other
zzz
[password-test]
Run Code Online (Sandbox Code Playgroud)
这是我的ansible.cfg:
[defaults]
ask_vault_pass = True
filter_plugins = filter_plugins
host_key_checking = False
retry_files_enabled = False
inventory = hosts
stdout_callback = debug
[paramiko_connection]
record_host_keys=False
[ssh_connection]
ssh_args = -o LogLevel=QUIET -o ControlMaster=auto -o ControlPersist=2m -o UserKnownHostsFile=/dev/null
scp_if_ssh = True
Run Code Online (Sandbox Code Playgroud)
rhel-tests.yml,因此现在可能会触发某种以前没有的超时。我已经尝试将rhel7的版本恢复到大约一个月前,但命令仍然失败,所以我认为这不太可能是原因。paramiko_ssh连接类型,但也失败了。ansible -i hosts_test -m ping 10.2.16.2跑回去打乒乓球rhel-tests.yml重启或关闭中没有任何行。是什么导致我的剧本失败,我该如何解决?
由于您的游戏缺乏输出,连接可能会断开。
将以下内容添加到您的ssh_args(v2.4 的文档)中ansible.cfg:
-o ServerAliveInterval=50
Run Code Online (Sandbox Code Playgroud)
其作用ServerAliveInterval=50是在游戏缺少输出时通过客户端每 50 秒向服务器发送一个空数据包来保持 ssh 连接处于活动状态。
| 归档时间: |
|
| 查看次数: |
10627 次 |
| 最近记录: |