Я пытаюсь использовать sonarqube API с ансиблемным скриптом. Вот что я получил:
---
- hosts: TestClient
vars:
sonar_url: **************
roles:
- Sonar
Моя роль сонара:
- name: test task2
uri:
url: https://admin:admin@{{ sonar_url }}/api/users/change_password
method: POST
body: "{{ lookup('file', 'Authenticate.json') | from_json }} "
body_format: json
headers:
Accept: "application/json"
return_content: yes
force_basic_auth: yes
status_code: 204
validate_certs: no
И мой файл JSON:
{
"login": "admin",
"password": "admin",
"previousPassword": "admin"
}
Файл JSON находится в том же каталоге и может быть прочитан.Если я сейчас выполню сценарий, я получу сообщение об ошибке:
Полный ответ:
fatal: [*************]: FAILED! => {
"changed": false,
"connection": "close",
"content": "{\"errors\":[{\"msg\":\"The 'login' parameter is missing\"}]}",
"content_length": "55",
"content_type": "application/json",
"date": "Fri, 08 Feb 2019 10:22:14 GMT",
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": {
"login": "admin",
"password": "admin",
"prevopusPassword": "admin"
},
"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": true,
"group": null,
"headers": {
"Accept": "application/json",
"Authorization": "Basic *********=",
"Content-Type": "application/json"
},
"http_agent": "ansible-httpget",
"method": "POST",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": true,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
"204"
],
"timeout": 30,
"unsafe_writes": null,
"url": "https://*********/api/users/change_password",
"url_password": null,
"url_username": null,
"use_proxy": true,
"validate_certs": false
}
},
"json": {
"errors": [
{
"msg": "The 'login' parameter is missing"
}
]
},
`
Насколько я знаюфайл JSON может быть прочитан, как показано выше, но не преобразован должным образом, так что запрос POST может фактически получить эту информацию.
Мой вопрос здесь: есть ли опция конфигурации или что-то в моем файле JSONчто мне не хватает?
Спасибо за ваше время и помощь.