Ansible-补救票据自动化
我正在尝试使用Ansible自动创建补救事件管理记录单。为此,我试图连接到补救API,但我得到以下错误 代码: 更准确地说。我的补救措施需要用户名和密码以及访问令牌,为此我在标题部分添加了授权。添加授权可能是我错了 错误:Ansible-补救票据自动化,ansible,remedy,Ansible,Remedy,我正在尝试使用Ansible自动创建补救事件管理记录单。为此,我试图连接到补救API,但我得到以下错误 代码: 更准确地说。我的补救措施需要用户名和密码以及访问令牌,为此我在标题部分添加了授权。添加授权可能是我错了 错误: fatal: [localhost]: FAILED! => { "access_control_allow_headers": "authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction",
fatal: [localhost]: FAILED! => {
"access_control_allow_headers": "authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction",
"access_control_allow_methods": "POST",
"access_control_allow_origin": "*",
"cache_control": "must-revalidate,no-cache,no-store",
"changed": false,
"connection": "close",
"content": "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\n<title>Error 500 </title>\n</head>\n<body>\n<h2>HTTP ERROR: 500</h2>\n<p>Problem accessing /api/jwt/login. Reason:\n<pre> Request failed.</pre></p>\n<hr />\n</body>\n</html>\n",
"content_security_policy": "frame-ancestors 'self'",
"content_type": "text/html;charset=iso-8859-1",
"date": "Tue, 14 Apr 2020 11:17:07 GMT",
"msg": "Status code was 500 and not [200]: HTTP Error 500: Request failed.",
"redirected": false,
"status": 500,
"transfer_encoding": "chunked",
"url": "https://testapi.xyz.com/t/app.misc/remedyLogin/1.0/login",
"x_frame_options": "SAMEORIGIN"
}
fatal:[localhost]:失败!=>{
“访问控制允许标题”:“授权、访问控制允许来源、内容类型、SOAPAction”,
“访问控制允许方法”:“POST”,
“访问\控制\允许\来源”:“*”,
“缓存控制”:“必须重新验证,无缓存,无存储”,
“更改”:错误,
“连接”:“关闭”,
“内容”:“\n\n错误500\n\n\nHTTP错误:500\n访问/api/jwt/login时出现问题。原因:\n请求失败。\n
\n\n\n”,
- name: Create a Incident Ticket
uri:
url: https://testapi.xyz.com/t/app.misc/remedyLogin/1.0/login
method: POST
headers:
"Authorization": "Bearer xxxxx-xxxxxx-xxxxxxxxx-xxxxx"
"Content-Type": "application/x-www-form-urlencoded"
body: '{"username": "some_username", "password": "some_password"}'
body_format: form-urlencoded
validate_certs: False
force_basic_auth: yes
return_content: yes
status_code: 200
register: result
“内容安全策略”:“框架祖先的自我”,
“内容类型”:“文本/html;字符集=iso-8859-1”,
“日期”:“2020年4月14日星期二11:17:07 GMT”,
“msg”:“状态代码是500而不是[200]:HTTP错误500:请求失败。”,
“重定向”:错误,
“地位”:500,
“传输编码”:“分块”,
“url”:”https://testapi.xyz.com/t/app.misc/remedyLogin/1.0/login",
“x_框架选项”:“SAMEORIGIN”
}
请在这方面帮助我。您需要将body\u format参数添加到uri模块 例如:
有没有包含更多信息的日志条目?
- name: Create a Incident Ticket
uri:
url: https://testapi.xyz.com/t/app.misc/remedyLogin/1.0/login
method: POST
headers:
"Authorization": "Bearer xxxxx-xxxxxx-xxxxxxxxx-xxxxx"
"Content-Type": "application/x-www-form-urlencoded"
body: '{"username": "some_username", "password": "some_password"}'
body_format: form-urlencoded
validate_certs: False
force_basic_auth: yes
return_content: yes
status_code: 200
register: result