I have a playbook which looks like
- name: CURL post example
uri:
url: "https://dev-box.local/api/"
method: POST
body: '{
"max_conns": 0,
"max_fails": 2,
"fail_timeout": "3s"
}'
body_format: json
validate_certs: no
return_content: yes
force_basic_auth: yes
headers:
Content-Type: "application/json"
but during the execution I'm getting
FAILED! => {"changed": false, "connection": "close", "content": "{\"status\":403,\"message\":\"Forbidden\"}\n", "content_length": "37", "content_type": "application/json", "date": "Thu, 03 Dec 2020 21:03:13 GMT", "elapsed": 0, "json": {"message": "Forbidden", "status": 403}, "msg": "Status code was 403 and not [200]: HTTP Error 403: Forbidden",
when I will do the same call as the curl -k
from the command line on the same box as ansible it works fine.
Any thoughts on that?