ansible - CentOS/Ansible - 如何修复错误“_ssl.c:602:握手操作超时”
问题描述
我正在为网络设备运行 API 登录任务,有时我会收到此错误:"_ssl.c:602: The handshake operation timed out"
. 有时它会运行,有时它会出现握手错误。我最近在使用 SSH 时向网络设备添加了 RADIUS 身份验证,但 API 仍然使用本地凭据。但这会导致问题吗?
我使用的模块是基本的 URI 模块,任务如下所示:
- name: Login to switch using API
uri:
url: "https://{{ ansible_host }}/rest/v4/login-sessions"
method: POST
headers:
Accept: "application/json"
Content-Type: "application/json"
body: {"userName": "{{ ansible_user }}", "password": "{{ ansible_password }}"}
body_format: json
validate_certs: no
status_code: 201
register: switch_session
我得到的错误如下:
fatal: [test_switch]: FAILED! => {
"changed": false,
"content": "",
"elapsed": 30,
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": {
"password": "<PASSWORD>",
"userName": "<USERNAME>"
},
"body_format": "json",
"client_cert": null,
"client_key": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
},
"http_agent": "ansible-httpget",
"method": "POST",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
"201"
],
"timeout": 30,
"unix_socket": null,
"unsafe_writes": null,
"url": "https://<IP_ADDR>/rest/v4/login-sessions",
"url_password": null,
"url_username": null,
"use_proxy": true,
"validate_certs": false
}
},
"msg": "Status code was -1 and not [201]: Request failed: <urlopen error ('_ssl.c:602: The handshake operation timed out',)>",
"redirected": false,
"status": -1,
"url": "https://<IP_ADDR>/rest/v4/login-sessions"
解决方案
推荐阅读
- javascript - DOM 中的 hasAttribute 无法正常工作
- spring-mvc - 如何正确设置休眠验证器 6.0.10.Final
- c# - 如何在运行时更改 asp.net core 中的启动数据?
- c - libPAPI:最大同时事件度量
- java - Maven中的依赖地狱
- laravel - Laravel 条件雄辩查询
- amazon-s3 - 使用存储在 s3 中的 parquet 文件在 Greenplum 中创建外部表
- javascript - 循环查询选择器,未定义的内部循环
- arrays - 将 traceroute IP 与数组值进行比较
- android - 如何在 BookmarkActivity 上添加 Toast.makeText